I have a library project called MyLib, in which I have a namespace called Extensions, in which there is a module called Extension1, which has a method called ext1Method1 of type string -> string.
In the solution for the library project, there is an executable console project called Test. Within Test I can call MyLib.Extensions.Extension1.ext1Method1 str and it works fine.
I have created a completely separate solution called NewSol1 and included a reference to MyLib.dll in NewSol1. In NewSol1 there is a line
printfn "%s" (MyLib.Extensions.Extension1.ext1Method1 "Hello, World")
The solution NewSol1 builds without any error. But when I run the executable I get the following error:
System.MissingMethodException was unhandled
Message: An unhandled exception of type 'System.MissingMethodException' occurred in NewSol1.exe
Additional information: Method not found: 'Microsoft.FSharp.Collections.FSharpList`1<System.String> MyLib.Extensions.Extension1.ext1Method1(System.String)'.
Thanks in advance for your help.
I'm posting a succinct answer here even though the link provided by ildjarn answers the question: to fix the problem, ensure that the Nuget packages in the two solutions are the same.
In my case, the library used a slightly older version of FSharp.Core. Since I had the freedom to recompile the library against any version of FSharp.Core, I chose to update all the Nuget packages in both the library and the consumer. I did this by right-clicking the library solution, choosing Manage Nuget Packages for Solution... and making sure all of the packages were up-to-date.
Related
While trying to use ProGuard (5.3.2) to obfuscate a Automation framework getting lot of warnings i've resolved most of the warnings by adding respective library's but could not able to resolve below warnings. i have tried by adding com.hibernate-core jar but still getting same.
Warning: com.test.utils.DBOperations: can't find referenced method 'org.hibernate.Session openSession()' in library class org.hibernate.SessionFactory
Warning: com.test.utils.DBOperations: can't find referenced method 'void close()' in library class org.hibernate.Session
I have tried searching for a solution but the answer would always be for an android application.
I have find there is an option that I can select inside the Proguard GUI. Please check the picture:
This method is good for obfuscation the class name or method name inside the .jar file.
If you want to ignore the warning when creating from android studio or eclipse... just put some "-dontwarn" or "-ignorewarning" command inside the proguard-rule.pro file.
I am trying to use a method from a DLL in a OSGI-bundle. The DLL gets loaded correctly in OSGI, but I still get an java unsatisfied link error, the native method is not found!
When deployed standalone in Java only (no OSGI), the DLL gets loaded and run perfectly.
Here's what I did:
I generated a JNI bridge to my C++ compiled DLL through SWIG.
I specified the package name when calling swig.
I declared the dll inclusion in my Maven pom.xml xml element, which generates a correct Manifest file.
Loading of the DLL libraries is done without any errors / warnings
What truly puzzles me is that the symbols in the dll seem to not be found:
java.lang.UnsatisfiedLinkError: com.bmw.corona.components.sample.impl.generated.AdasDeconstructorJNI.swig_module_init()V
The problem is when coupling it with OSGI, I'm guessing somewhere in OSGI's ClassLoader.
The method in the dll seems to have a the correct signature :
_Java_com_bmw_corona_components_sample_impl_generated_AdasDeconstructorJNI_swig_1module_1init#8
with the following prototype in the generated SWIG file:
SWIGEXPORT void JNICALL Java_AdasDeconstructorJNI_swig_1module_1init(JNIEnv *jenv, jclass jcls)
I was triple-sure to check that the Manifest includes the Bundle Native instruction.
What am I doing wrong?
You may want to consult this wiki article: http://wiki.osgi.org/wiki/Dependencies_In_Native_Code
It is hard to tell from your description, but it sound like you have 2 native libs. One with the JNI entry points and the other with the real native function. The above wiki article discusses the dependencies from the JNI native lib to other native libs.
The problem was twofold. First, the methods weren't found do to Visual Studio 2010's method name mangling. I added a linker directive :
#pragma comment(linker, "/EXPORT:__Java_com_bmw_corona_components_sample_impl_AdasDeconstructorJNI_swig_module_init=_Java_com_bmw_corona_components_sample_impl_AdasDeconstructorJNI_swig_1module_1init#8")
It does take a bit of time for all the bundles (more than 100) to get up and running, and I do get a java.lang.NullPointerException: null the first couple of seconds after launch. Afterwards, everything seems to be working fine. And the nullPointerException is gone..
In my solution created with MonoDevelop (3.0.3.5) I have 3 projects:
MonoTouch project with UI,
MonoTouch Library project with iOS specific code,
Portable Library project with domain model.
The Portable Library project won't compile, and shows warning symbols on the references (System, System.Core, System.Xml) in MonoDevelop. When I unfold the assembly reference, the following error message is shown:
Assembly not available in .NETPortable 4.0 Profile1 Profile (in Mono 2.10.9)
Same problem reported in this forum thread.
Does anyone have the same problem and is able to solve it?
Update
Demo solution with the build errors can be found on GitHub here (bgever/plp-build-error).
I found out that although the error messages are shown, basic code can be compiled and works as expected.
However, the two variants of build errors preventing the demo solution from compiling are:
public T Get<T> (Expression<Func<T, bool>> predicate) where T : new() {
Using the generic type System.Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,TResult>' requires10' type argument(s) (CS0305)
So it seems that the 2 argument generic overload Func<T, TResult> is not supported?
public void RunInTransaction (Action action) {
Using the generic type System.Action<T>' requires1' type argument(s) (CS0305)
So it seems that the non-generic version of Action cannot be found?
With the additional error messages, I've found the following SO question: MonoDevelop: is it possible to switch PCL's compiler? With the answer from #mhutch provided, the MonoTouch compiler can be enforced and is then able to compile the code.
However, this is just a workaround, therefore, still it would be great to see proper Portable Class Library support in Mono, MonoDevelop and MonoTouch.
If you need proper Portable Class Library support too: vote for this feature on Xamarin's UserVoice.
I've also had a similar problem with the .Net references within a PLP, what I actually did was to remove the existing references and add them back manually from where your .Net Framework is installed, restart MonoDevelop and I was up and running again.
my issue is very similar to:
http://www.dotnetmonster.com/Uwe/Forum.aspx/dotnet-vb/54944/VB-Net-project-throwing-errors-when-executing-Clean-Solution
Typical errors: Unable to load referenced library X
Type IWshRuntimeLibrary.WshShell is not defined.
Interface System.IDisposable is not implemented by this class.
Namespace of type specified in the Imports Z does not contain any public members or cannot be found. Make sure the imported element name does not use any aliases.
This must have to do with a VB.net project configuration. Currently there is a setting "Treat all warnings as errors". I would like to keep that setting, but also resolve these annoying "errors".
I've experienced a similar problem and fixed it by running the following command in the VS command line tool
devenv /resetskippkgs
I'ev had problems executing Clean's via MSBuild in VS2008 when projects were registered for COM interop.
The problem is that the "Clean" target auto-generated for a solution cleans projects in the same order in which they were built.
This causes problems for projects registered for COM when MSBuild attempts to load and then unregister the assembly from COM during a "Clean".The issue occurs if the assembly has a dependency on another project because the dependency will be deleted first and therefore loading the assembly will fail and MSBuild will be unable to unregister it.
A workaround is to change the solution .cache file (which contains the targets auto-generated by MSBuild during "Build") and reverse the order of the "Clean" target. I hacked-together a quick-fix custom build task to do this as a post-build step.
No idea if this was fixed in VS2010 or indeed if this matches your problem since you don't give many specifics in your question ;)
I just started learning Javafx with Java11
I created a project in IntelliJ and it gave the standard structure.
In src file when I change the package name for the package "sample" to anything else, IntelliJ gives the following error.
Error:Kotlin: The Kotlin standard library is not found in the module graph. Please ensure you have the 'requires kotlin.stdlib' clause in your module definition
The error disappears when I refactor the package back to "sample".
how do I rename without getting this problem.
this might be helpfull
Javac gives this error, when lint is enabled and you use Java 9 module in Kotlin. You have to declare "requires kotlin.stdlib" in your module-info.java.
Ran into the same issue. For me, I'm using a module-info file in the src folder that looks like this:
module javafx {
requires javafx.fxml;
requires javafx.controls;
requires javafx.graphics;
opens sample;
}
If you rename your package to foo, then you need to change the last line to "opens foo". Otherwise it's still gonna look for and try to open a package named "sample". I have no idea what this has to do with kotlin.
I had the same problem and I solved it disabling "Kotlin migration detection". I have already response here:
https://stackoverflow.com/a/59628873/2350799
I had the same problem. But as long as you are not using Kotlin in the project there is a workaround : disable the Kotlin plugin, under settings.