Working with MvvmCross.Plugin.Location.Fused - c#

MvvmCross.Plugin.Location.Fused
Trying to get all the Mvvmcross plug-in work in my demo project.
The sample project come from here
https://github.com/MvvmCross/MvvmCross-Samples/tree/master/XPlatformMenus
Once I have add it from nuget
MvvmCross.Plugin.Location.Fused
Severity Code Description Project File Line Suppression State
Error CS0305
Using the generic type 'MvxPluginBootstrapAction' requires 1 type arguments
XPlatformMenus.Droid
There isn't much docs for the all those plugin .
Hopefully I can get it up and running and see what it really can do.

It needs to be MvxLoaderPluginBootstrapAction instead of MvxPluginBootstrapAction
public class LocationPluginBootstrap
: MvxLoaderPluginBootstrapAction<MvvmCross.Plugins.Location.PluginLoader, MvvmCross.Plugins.Location.Fused.Droid.Plugin>
{
}
This has been fixed, but is not released, yet: https://github.com/MvvmCross/MvvmCross-Plugins/commit/1ff418ca2af0ede8113b6478000522b7631d1030

Related

Unreal Engine 4.22 Could not find definition for module

I'm taking a course for Unreal Engine 4 and I seem to have run into a compilation error.
I only have maybe 3 days experience with Unreal.
I am an expert at C++.
I have never touched C Sharp before which is why it is irritating that C Sharp is being used in small parts of the example project when I was promised that only C++ is used in Unreal Engine 4 projects.
The logfile ends as follows:
LogVSAccessor: Warning: Couldn't access Visual Studio
Candidate modules for hot reload:
BullCowGame
Launching UnrealBuildTool... [C:/Program Files/Epic Games/UE_4.22/Engine/Binaries/DotNET/UnrealBuildTool.exe -ModuleWithSuffix=BullCowGame,6263 Win64 Development -TargetType=Editor -Project="C:/Users/school/Desktop/unreal_course_projects/bull_cow_game_attempt_2/BullCowGame-starter-kit/BullCowGame.uproject" "C:/Users/school/Desktop/unreal_course_projects/bul
l_cow_game_attempt_2/BullCowGame-starter-kit/BullCowGame.uproject" -IgnoreJunk]
Warning: Starting HotReload took 1.5s.
CompilerResultsLog: New page: Compilation - May 6, 2020, 9:08:11 PM
CompilerResultsLog: Using 'git status' to determine working set for adaptive non-unity build (C:\Users\school\Desktop\unreal_course_projects\bull_cow_game_attempt_2\BullCowGame-starter-kit).
CompilerResultsLog: Creating makefile for BullCowGameEditor (game project files are newer)
CompilerResultsLog: ERROR: Could not find definition for module 'BullCowGame' (referenced via BullCowGameEditor.Target.cs)
LogMainFrame: MainFrame: Module compiling took 37.379 seconds
Warning: HotReload failed, recompile failed
LogSlate: Window 'Message Log' being destroyed
LogSlate: Window 'Message Log' being destroyed
BullCowGameEditor.Target.cs:
// Fill out your copyright notice in the Description page of Project Settings.
using UnrealBuildTool;
using System.Collections.Generic;
public class BullCowGameEditorTarget : TargetRules
{
public BullCowGameEditorTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Editor;
ExtraModuleNames.AddRange( new string[] { "BullCowGame" } );
}
}
BullCowGame.Target.cs:
// Fill out your copyright notice in the Description page of Project Settings.
using UnrealBuildTool;
using System.Collections.Generic;
public class BullCowGameTarget : TargetRules
{
public BullCowGameTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
ExtraModuleNames.AddRange( new string[] { "BullCowGame" } );
}
}
The project layout:
The error I'm trying to fix: ERROR: Could not find definition for module 'BullCowGame' (referenced via BullCowGameEditor.Target.cs)
You can see this error towards the bottom of the log file.
Has anyone seen this before?
Thanks in advance
Looking at your project layout, you are missing .../Source/BullCowGame/BullCowGame.Build.cs which describes how to build the BullCowGame module.
See: https://docs.unrealengine.com/en-US/ProductionPipelines/BuildTools/UnrealBuildTool/ModuleFiles/index.html

Table has no (public) columns only on real device

I have the simplest of apps that I thought I would try on my device before I got too engrossed. However, I am getting the strangest error message when I run it on my iPhone (as apposed to the the emulator on my macbook).
Table has no (public) columns .
I am using the SQLite.Net PCL and I have built it from git hub as I had some problems with it not having the platform dlls for IOS otherwise.
Relevant code.
In my models I have this:
public class Setting
{
[PrimaryKey, AutoIncrement]
public long Id { get; set; }
[Indexed]
public string Key { get; set; }
public string Value { get; set; }
}
The code that throws this error message is the simple:
using (SQLiteConnection db = GetCon ()) {
db.CreateTable<Setting> ();
}
but in my opinion the strangest thing is that this code works fine on the emulator but crashes the application on the iphone itself.
If anyone has some ideas that would be great.
EDIT:
This error is thrown on the SQLite.Net-PCL library on this file line 380 but only on the device and not on the emulator.
For others to whom this may concern, I found the answer to my problem. The issue was with the Type not having any properties (the type in question the simple model class). Knowing that to be rubbish I found the following links that gave more information which I will relate in this post in case the links go dead:
Type.GetProperties returning nothing
NOTE: Be careful with assembly linker
If you're building with linker enabled you may need to use the class
somewhere, so it will not be ripped off at compile time. Sometimes,
only instantiating the class in your code is not enough, the linker
may detect that the instance is never used and will remove it anyway.
http://developer.xamarin.com/guides/ios/advanced_topics/linker/
The linking process can be customized via the linker behavior
drop-down in Project Options. To access this double-click on the iOS
project and browse to iOS Build > Linker Options, as illustrated below
(see link for details)
I have for now left it to be unlinked, however, I will try before release to get the linker to ignore these classes. Thanks for all your help.
I found my problem was just a (not that subtle) programming error. I was working with the TypeInfo class and wanted to use the Sqlite Connection method:
CreateTable (Type type);
What I had in my hand was a TypeInfo instance which I needed to convert back to the System.Type. I accidentally without thinking used the GetType() method instead of AsType() method which is obvious when you think about it. The clue I got was in the exception message along with the OP message was does System.Runtime have public properties?
var type = table.TypeInfo.AsType();
// var type = table.TypeInfo.GetType(); *WRONG*
connection.CreateTable(type);

XAML MarkupCompilePass2 fails on a WPF project

When I try to build my WPF project I get the folowing error:Samotorcan.Client.WPF.Windows8\Views\MainWindow.xaml(1,17): error MC3074: The tag 'Window' does not exist in XML namespace 'clr-namespace:Samotorcan.Client.WPF.Windows8.Controls'. Line 1 Position 17.The problem only occurs when I try to use linq. If I have a line like this new List<object>().ToArray<object>(); somewhere in the MainWindow.xaml.csfile I get the above error and if I change it to new List<object>().ToArray(); the error disappears and the project builds successfully.I also checked the build log and it contains the same error at task MarkupCompilePass2.I am using .NET Framework 4.5 and Visual Studio 2012.EDITAfter playing with it a bit I managed to find out that it's not specificly related to linq an random changes like removing an unused file from a project or just removing parts of code like a simple string creating string s = new String(); fixes the error.At one point a simple change in a constructor from this
public LoggedEventArgs(string message)
{
Message = message;
}
to this
public LoggedEventArgs(string message)
{
// Message = message;
}
fixed the error.
Managed to find a workaround for the above error by moving all my controls from the project into a separate project just for controls.
Now there are no random errors on build because as it looks like it can always find the window and other controls that are now in a separate assembly.

How to fix Unity Container Warning: "ContainerElement.Configure(Unity.IUnityContainer) is obsolete"?

I have just installed Prism4 on my box and trying to get started working on a example of Unity (UnityContainer).
I am using SL4, Prism4, .Net Framework4, VS 2010 Ultimate.
I am getting a warning in the class Program.cs on line configSection.Containers.Default.Configure(container);
Microsoft.Practices.Unity.Configuration.ContainerElement.Configure(Microsoft.Practices.Unity.IUnityContainer)'
is obsolete: '"Use the UnityConfigurationSection.Configure(container,
name) method instead'
This is the code that I wrote:
var configurationSection = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");
foreach (ContainerElement containerElement in configurationSection.Containers)
{
container =configurationSection.Configure(container, containerElement.Name);
}
I understand that the old method is deprecated and needs to be replaced, but how can this be done? The code I tried above seams to be not working correctly.
A previous method in the Unity library - Microsoft.Practices.Unity.Configuration.ContainerElement.Configure(Microsoft.Practices.Unity.IUnityContainer) has now been replaced with a new implementation UnityConfigurationSection.Configure(container, name).
It's telling you that the original method has been replaced by a new one the new version of the Unity library so just use the new method. If you want the legacy method you will need to use an old version of the Unity library.

Code Contract : ccrewrite exited with code -1?

I'm new to code contracts. I downloaded the latest build of code contract project (1.4.40314.1) and started to implement it in my project. When i enabled 'Runtume Checking' through Code Contracts Tab in VS2010, i got this Error
Error 1 The command ""C:\Program Files (x86)\Microsoft\Contracts\Bin\ccrewrite" "#Application1ccrewrite.rsp"" exited with code -1.
everytime i build the project. Plz help.
Now it's a major problem for me.
Every project using code contracts is showing same error in VS2010 Errors window and 'Application1ccrewrite.rsp' not found in output window, but it is there.
I tried out everything. I installed both versions (Pro, Std) but the problem persist. Plz help !
I had this problem as well. In my case the problem was that ccrewrite cannot work with files in a network folder but requires the project to be on your local hard disk.
I had this problem. The Assembly name and Default namespace of the class library that causes the problem had the same name as an existing DLL in the destination folder. I had been refactoring my code and whilst the namespaces in the CS files had all be changed to namespace2 the default namespace in the properties file was still namespace1
When I corrected this the files all built successfully...
Sometimes you can get this when your solution path is too long, especially with many projects.
Try moving to c:\temp and building it, it might fix it (although of course, this might not be a solution if you need it in the folder it currently is).
This bug I noticed in earlier CC versions and may now be fixed.
I don't know if you had the same problem as me, but I also saw this error. In my case, I had a method with a switch statement, and depending on the branch taken, different requirements applied:
static ITransaction CreateTransaction(
String transType,
MyType1 parm1,
/* Other params unimportant to this example */
String parm5)
{
switch (transType) {
case Transaction.Type.SOME_TRANSFER:
Contract.Requires<ArgumentNullException>(parm1.Account != null, "Account cannot be null.");
Contract.Requires<ArgumentException>(!String.IsNullOrWhiteSpace(parm5), "parm5 cannot be null or empty.");
// Create instance
return someInst;
case Transaction.Type.SOME_OTHER_TRANSFER:
Contract.Requires<ArgumentException>(!String.IsNullOrWhiteSpace(parm1.Type), "Type cannot be null or empty.");
Contract.Requires<ArgumentException>(!String.IsNullOrWhiteSpace(parm1.Number), "Number cannot be null or empty.");
// Create instance
return someInst;
/* Other cases */
default:
throw new ApplicationException("Invalid or unknown transaction type provided.");
}
}
This was giving me the error you noted in the Errors List when I tried to build. In the output window, I was getting this:
EXEC : Reference Assembly Generator
warning : Something is wrong with
contract number 1 in the method
'TerraCognita.LoanExpress.Domain.Loan.CreateLoanTransaction'
AsmMeta failed with uncaught
exception: Operation is not valid due
to the current state of the object.
I pushed each branch into a method of its own, making Contract.Requires the first lines of code in each method, and I no longer had a compilation problem. It appears that Contract.Requires must be the first lines of code in a method - which makes sense, since they are intended to be used to define pre-conditions.
Hope this helps.
The solution is to put the pre and pos conditions in the first lines. The ccrewrite does not accept that pre and post conditions are below command lines.

Categories