IKVM.Runtime exception in .Net Core 2.0 - .net-core-2.0

I am getting the below exception in IKVM.Runtime.dll when using IKVM in .net core 2.0 application:
Method not found: 'Void System.Reflection.Emit.ILGenerator.EmitCalli(System.Reflection.Emit.OpCode, System.Runtime.InteropServices.CallingConvention, System.Type, System.Type[])'.
I know that IKVM only support .Net Framework. So is there any way to solve the issue?

The method has been removed or hidden from .NET API. It is only needed to compile stream API in Java. By rewriting your streams to Java 6 cycles you'll remove calling this method.

Related

Upgraded to EF Core 3.1 and now IProperty.get_ClrType is missing

When I upgraded my project from EF Core 2.2 to EF Core 3.1 I started getting this error:
Method not found: 'System.Type Microsoft.EntityFrameworkCore.Metadata.IProperty.get_ClrType()'.
This is in a Breeze module.
I looked in the Breaking Changes and could not see anything that matches this (though it could be that the metadata references are including this and I just don't understand them).
Is this supposed to be missing? Is there a workaround?

MSMQ support for .net core

It looks like there are no libraries provided in .net standard / .net core to support MSMQ.
In that case, how can we use MSMQ while working with asp.net core 2.0 and above web application?
I recently noticed this NUGET package: Experimental.System.Messaging
I've not yet tried it but it seems like it might be helpful for what you need.

Core 2 error referencing Framework libraries

I have a test project int Core 2 console (Core2ConsoleTest).
It make a reference to .NET Framework 4.6.1 Project (NetFrameworkTest).
NetFrameworkTest project references the standard System.Printer.dll.
Download Core2ConsoleTest project here
When I call to any System.Printer function I have the error: Could not load file or assembly 'System.Printing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. El sistema no puede encontrar el archivo especificado.
I tested with other standard libraries like System.Windows.Forms.dll and the same error if the Core project references a Nuget Package that uses standard libraries.
Note: The same error with ASP.Net Core 2
Thanks for your help!
This is not going to work on .NET Core.
.NET Core 2.0 has a compatibility layer that allows loading and using .NET Framework libraries but this only works as long as this library only uses types and methods that are also available on .NET Core.
Since System.Printing is not part of .NET Core, this library will fail to access it with the exception you posted.
Only .NET Framework applications can use this API (e.g. an ASP.NET Core on .NET Framework application).
I really have the problem with ASP.Net Core Framework Project. I'm unable to create a new Project with Core 2.0 and reference a Framework library that references System.Printing.dll or other libraries.
But #mairaw gave me another way: On a project that works in Core 1.1, updating the libraries Nuget to 2.0, works correctly.
So it looks like a Visual Studio 2017 problem or Core templates.
My concern is to remove this functionality, because it allows to adopt the Core technology in a staggered way with a high code reuse.
Edit: Added sample projects
CoreTest.zip -> A ASP.Net Core Framework Project created referencing Core 1.1 and .NET Framework 4.6.1 in the past, then upgraded to Core 2.0 using Nuget: WORKS!
Core2Framework.zip -> A similar project (ASP.Net Core Framework Project created referencing Core 2.0) created with Visual Studio 2017 15.3.4: ERROR when calling System.Prinig.dll from the .NET Framework 4.6.1 Project.

Receiving error 'Could not load file or assembly 'Interop.SearchAPI' or one of its dependencies.'

The full message is 'Could not load file or assembly 'Interop.SearchAPI' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.'
After changing some application pools in IIs 7.5 from 2.0 to 4.0 and then back to 2.0 I now receive the above error message. I'm not sure what I need to do to switch the assembly from 4.0 to 2.0.
Thanks for the help!!
Gary
You did not tell us what was your reasons for switching from .NET 4.0 to .NET 2.0.
There are major differences between these runtimes. You can load .NET 2.0 assembly in .NET 4.0 environment but it is not possible to do the other way. If you need to run your application in .NET 2.0 environment then the only option for you is to rebuild all assemblies using .NET 2.0 (or max. .NET 3.5 because the underlying CLR format is the same).
You can read more about .NET versions and compatibility here and here.

How to use C# 4.0 Dll in C# 2.0 dll?

Plugin program could be coded with C# 2.0 or 3.0, not 4.0, so I want to call a dll coded with C# 4.0 in the plugin dll.
I have installed both frameworks.
How can I do that? Thanks.
I tried reference and COM, both are fail.
Possibly, you need create new AppDomain and download your plugin into it (please note that you need to subscribe to the events of reference resolution). Another way is another process and interprocess communication.
The CLR is not forward compatible.
Have a look at ths link
The DLL might expose an interface which uses 3.0/3.5/4.0 features, so the caller needs to know the features to use them.
Only way would be to wrap it using unsafe code or a real COM registration as an interface between an intermediary dll and the actual 4.0 dll, but I agree that providing a clean webservices via WCF is the better solution if you want to have 2.0 callers for a 4.0 dll.
Also note, that you do not need to install CLR 2.0 seperately - it will be installed implicitly when installing 4.0.

Resources