Updating to last version of the monodroid and now the solution not builds - xamarin.android

Today I update my monodroid to the its last version. Before this my solution works fine but no I got this errors:
MyProjectPath\Classes\Presentation Layer\Class Override\ImageLoaderListener.cs(15,15): Error CS0012: The type 'Java.Lang.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=c4c4237547e4b6cd'. (CS0012) (RPLAndroidApp)
and also this:
MyProjectPath\Class Override\ImageLoaderListener.cs(15,15): Error CS0012: The type 'Android.Runtime.IJavaObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=c4c4237547e4b6cd'. (CS0012) (RPLAndroidApp)
I tried to recompile my java library that I build by 'JavaBindingLibraryProject' and add them again to project but When I build them I get many errors.
I'm confused what should I do?

Rebuild all your projects with the new version of Mono for Android. You have to do this because of the changes in Assembly strongnames.

Related

Could not load file or assembly 'Launch, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified : Migration Error

I have been working on Entity framework recently i'm facing some challenging like when attempt to run the migration command it will show this Error
"Could not load file or assembly 'Launch, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified"
please if can help with i will be appreciated a lot
in my case. I solved this error by correcting the spelling of my target project from where I was calling it in the extension of my services for the startup class.
In my case as well, the error was due to the project name being misspelt in my startup class within the ConfigureServices method.
public void ConfigureServices(IServiceCollection services)
{
Constants.connectionString = Configuration.GetConnectionString("DefaultConnection");
// Add framework services.
services.AddDbContext<AppDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"),
b => b.MigrationsAssembly("ProjectNameHereWasMisspelt")));

"Consider app.config remapping" warnings in brand new project

I've created a brand new ASP.NET Framework MVC project (using the built in project template in Visual Studio 2019). This project was converted to use PackageReference using the answer provided here.
When I do a "Rebuild Solution", everything is fine.
I then add a new ASP.NET Framework Class Library (using the build in project templte in Visual Studio 2019) to the solution.
I do another "Rebuild Solution" and everything is still fine.
Now, when I add a reference to the class library project in the web project I get the following warnings when rebuilding the solution:
Consider app.config remapping of assembly "System.Buffers, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" from Version "4.0.2.0" [] to Version "4.0.3.0" [C:\Users\Me\.nuget\packages\system.buffers\4.5.0\ref\net45\System.Buffers.dll] to solve conflict and get rid of warning.
3> Consider app.config remapping of assembly "System.Memory, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" from Version "4.0.1.0" [] to Version "4.0.1.1" [C:\Users\Me\.nuget\packages\system.memory\4.5.3\lib\netstandard2.0\System.Memory.dll] to solve conflict and get rid of warning.
3> Consider app.config remapping of assembly "System.Numerics.Vectors, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.1.3.0" [] to Version "4.1.4.0" [C:\Users\Me\.nuget\packages\system.numerics.vectors\4.5.0\ref\net46\System.Numerics.Vectors.dll] to solve conflict and get rid of warning.
3> Consider app.config remapping of assembly "System.Runtime.CompilerServices.Unsafe, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.0.4.1" [] to Version "4.0.5.0" [C:\Users\Me\.nuget\packages\system.runtime.compilerservices.unsafe\4.6.0\ref\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll] to solve conflict and get rid of warning.
3> Consider app.config remapping of assembly "System.ValueTuple, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" from Version "4.0.2.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\Facades\System.ValueTuple.dll] to Version "4.0.3.0" [C:\Users\Me\.nuget\packages\system.valuetuple\4.5.0\ref\net47\System.ValueTuple.dll] to solve conflict and get rid of warning.
Here's a selection from the detailed build output:
1> Encountered conflict between 'Reference:C:\Users\Me\.nuget\packages\system.valuetuple\4.5.0\ref\net47\System.ValueTuple.dll' and 'Platform:System.ValueTuple.dll'. Choosing 'Reference:C:\Users\Me\.nuget\packages\system.valuetuple\4.5.0\ref\net47\System.ValueTuple.dll' because AssemblyVersion '4.0.3.0' is greater than '4.0.2.0'.
1> Encountered conflict between 'Platform:System.ValueTuple.dll' and 'CopyLocal:C:\Users\Me\.nuget\packages\system.valuetuple\4.5.0\lib\net47\System.ValueTuple.dll'. Choosing 'CopyLocal:C:\Users\Me\.nuget\packages\system.valuetuple\4.5.0\lib\net47\System.ValueTuple.dll' because AssemblyVersion '4.0.3.0' is greater than '4.0.2.0'.
1> Unified primary reference "System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51".
1> Using this version instead of original version "4.0.2.0" in "C:\Users\Me\.nuget\packages\system.text.json\4.6.0\lib\net461\System.Text.Json.dll" because AutoUnify is 'true'.
1> Resolved file path is "C:\Users\Me\.nuget\packages\system.valuetuple\4.5.0\ref\net47\System.ValueTuple.dll".
1> Reference found at search path location "{RawFileName}".
1> This reference is not "CopyLocal" because at least one source item had "Private" set to "false" and no source items had "Private" set to "true".
1> The ImageRuntimeVersion for this reference is "v4.0.30319".
I haven't done anything other than creating a project, converting to PackageReference, adding a class library, and adding a reference to that library. I haven't made any other changes at all. I haven't even added any new NuGet packages, so everything should be as clean as it can be. Yet I get these warnings!
If I create an identical solution without converting to PackageReference the warnings are never displayed, so it obviously has something to do with PackageReference, but what/why/how?
So why do these warnings appear in a "clean" solution? Is there anything I can do to make them disappear without having to add remappings in the web.config file?
Download a demo solution with the issue

Using System.Collections.Immutable with F# and Mono

I am trying to make use of the ImmutableDictionary in F# using Mono. I'm using the Xamarin IDE.
I have set my target framework to Mono/.Net4.5 and imported the System.Collections.Immutable using the built in Nuget package manager.
The following line
open System.Collections.Immutable
is generating the following two errors
'/Users/UserName/Projects/Xamarin/OrderInfer/OrderInference/MyTest.fs(34,34): Error FS1109: A reference to the type 'System.Collections.Generic.IEnumerable'1' in assembly 'System.Runtime' was found, but the type could not be found in that assembly (FS1109) (MyTest)'
/Users/UserName/Projects/Xamarin/OrderInfer/OrderInference: Error FS1108: The type 'Lazy'2' is required here and is unavailable. You must add a reference to assembly 'System.ComponentModel.Composition, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. (FS1108) (OrderInference)
The 2nd error suggests I need to reference System.ComponentModel.Composition. Am I able to use it in Mono? If so, is there another assembly I need to reference?
EDIT:
Solution removed and reposted below as an answer
This problem can be solved by adding a reference to: 'System.ComponentModel.Composition'. In Xamarin's IDE, this is done by using the Edit References Dialog which can be found by right-clicking on the reference in your project. Go to the All tab and search for System.ComponentModel and just add the System.ComponentModel.Composition assembly.
I now have the following two assemblies installed:
System.Collections.Immutable.dll
System.ComponentModel.Composition.dll
My code now reads:
open System
open System.ComponentModel.Composition
open System.Collections.Immutable
type wordPairs = { pairs:ImmutableDictionary<string, string>; count:int}
let myPairs = {pairs = ImmutableDictionary.Create<string, string>(); count = 0}
Note: As gradbot pointed out (and Immo Landwerth later nitpicked about ;>> ), ImmutableDictionary is a abstract sealed class. And as such, it has no public constructors. So you need to use the .Create method.
ImmutableDictionary is abstract so new won't work. It does however provide a number of create methods.
ImmutableDictionary.Create<string, string>()

ESB 2.2 EsbImportUtil.exe The type initializer for 'Microsoft.Practices.ESB.Configuration.ConfigHelper' throw exception

when importing the itineries using ESB 2.2 EsbImportUtil.exe following error is displayed
I have EnterpriseLibrary 5 installed and GAC contain EnterpriseLibrary 4.1 dll also.
The type initializer for 'Microsoft.Practices.ESB.Configuration.ConfigHelper' threw an exception.[A]Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection cannot be cast to [B]Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection. Type A originates from 'Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.Practices.EnterpriseLibrary.Common\5.0.414.0__31bf3856ad364e35\Microsoft.Practices.EnterpriseLibrary.Common.dll'. Type B originates from 'Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.Practices.EnterpriseLibrary.Common\4.1.0.0__31bf3856ad364e35\Microsoft.Practices.EnterpriseLibrary.Common.dll'.
Thanks for the help
Have you made any changes to esb.config file. Added new orchestation, try removing it. I had similar issue; fixed by removing wrong configuration.
Check:-
http://social.msdn.microsoft.com/Forums/en-US/bf2446fd-87fb-462a-8b78-cde7026bfdf5/the-type-initialize-for-microsoftpracticesesbconfigurationconfighelper-threw-an-exception?forum=biztalkesb

"A type load exception has occurred." using DbContext with MySql connector with Mono

I am trying to use the MySQL Database with the Entity Framework Version 4.1.0.0 and Mono 2.11.4 in a ASP.NET MVC 3 Project.
On my Local Windows system everything works great but when I publish it to my Ubuntu 12.04 LTS System I get a lot of errors.
First I get:
Could not load type 'System.Data.Entity.Infrastructure.DbUpdateException' from assembly 'EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
when I press F5 I get different errors every time the page refreshes:
Could not load type 'System.Data.Entity.Infrastructure.DbUpdateConcurrencyException' from assembly 'EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Could not load type 'System.Data.Entity.Infrastructure.DbCompiledModel' from assembly 'EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Could not load type 'System.Data.Entity.Infrastructure.ReplacementDbQueryWrapper`1[TElement]' from assembly 'EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Could not load type 'MySql.Data.VisualStudio.Editors.SqlEditor' from assembly 'MySql.VisualStudio, Version=6.6.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'.
Could not load type 'MySql.Data.VisualStudio.WebConfig.WebConfigDlg' from assembly 'MySql.VisualStudio, Version=6.6.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'.
A type load exception has occurred.
The last error occurred when I try to use the database with this code:
using (var db = new DefaultContext())
{
db.Persons.Add(new Person() { Name = "hallo", Address = "bllaaa" });
db.SaveChanges();
var persons = db.Persons.ToList();
return View(persons);
}
Did anybody have a similar problem and solved it? I do not know what to do.
P.S.: I use Code First Migration
From my understanding, Mono is bundling the open source version of Entity Framework, which is essentially yet-to-be-released v6.
http://weblogs.asp.net/scottgu/archive/2012/07/19/entity-framework-and-open-source.aspx
So it would seem you can't target EF v4.x, since the code has likely undergone major changes. Although, if you discover that the seemingly missing types are still there, you could attempt to work around the issue with an assembly redirect (just search for bindingRedirect).
I know why this happend.
I installed the mono-fastcgi-server4 through apt-get after i installed mono from source. So i had 2 mono versions installed and the older one was active. (2.10.8)
And the Entity Framework seems totally useless to me because only the new EF6 works with a database but there arent any provider who suppot EF6 and work with mono.

Resources