System.TypeLoadException.: 'Could not load type "" from assembly 'Core, Version=1.0.0.0, Culture=neutral, - c#

I'm currently having this issue during the debug of my code.
It continues giving me this
System.TypeLoadException 'Could not load type "" from assembly
'Core, Version=1.0.0.0, Culture=neutral.
What is the most interesting is the fact that, if I run the code on a different laptop, it runs withouth any problem.
Any reccomandation? Maybe changing some VS settings?
Thanks,
Arianna
I've tried to change the assembly name or follow a lot of suggestions I found online but nothing did work for me.

Related

Xamarin Unhandled Exception can't load MainActivity from assembly

I wanted to try making some android apps with Xamarin, but for some reason i just can't get around this error:
Unhandled Exception:
System.TypeLoadException: Could not load type 'LønCalc.MainActivity'
from assembly 'LønCalc, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null'. occurred
This is a fresh project and i haven't touched any of the code and in the past i could definitely launch any project with the default auto-generated code without issues.
I have an older project from about 4 months ago and that one can launch with no problems, and i created this project the same way, so i'm not sure why it can't load the MainActivity from the project assembly...Maybe there is some initial setup i missed, i'm a bit of a newbie.
Thanks in advance!!
Alright so i managed to find the solution, and it is super simple. Somehow the danish letter "Ø" in "LønCalc" was causing the exception. I made the exact same App but renamed it "SalaryCalc" and now i can run the app no problem.

Could not load type 'NameSpace.ClassName' from assembly 'AssemblyName, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'

I am working on fixing broken tests for an iOS app made with Xamarin.
One of the tests is testing that a file downloads and the code is similar to this:
public void DownloadFile(FileObject pProjectFile, string pTempFile, Action<DownloadEventArgs> pDownloadCallback)
{
ITransferUtility transfer = NameSpace.GetTransferUtility(pProjectFile);
transfer.Download(pTempFile, pDownloadCallback);
}
The problem is that I get a System.TypeLoadException Could not load type 'NameSpace.ClassName' from assembly 'AssemblyName, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. when I call transfer.Download.
The assembly is a project in the solution.
What's weird is that if I do
var type = Type.GetType("NameSpace.ClassName", true); there are no exceptions thrown.
Also, this doesn't happen when downloading a file through the app, it only occurs with the test project which is just a testrunner on top of the app.
A couple thing I've tried:
delete bin and obj from the testrunner project and the referenced assembly's project and do a clean and build of the solution
add [InternalsVisibleTo("TestRunnerProject)"] to the file with the class that is mentioned in the TypeLoadException.
I am running this on Xamarin for Mac so I don't have all the tools available that I've seen mentioned in other questions such as this one

C# PCL+UWP - Failed to load "System" assembly

I've got a project which has a Portable Class Library as "back-end" and a Universal Windows app for "front-end". Here is my repo at GitHub: huming2207/Rmiter
My target settings for the PCL library is "portable46-net451+win81", also the screenshot shows below:
When running the app it stuck at the beginning, showing a System.IO.FileLoadException from the backend PCL library, as below:
System.IO.FileLoadException: 'Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'
...and here is the screenshot (in case if someone misunderstand my words):
But meanwhile I can see there was a "System.Runtime.dll" loaded when the app starts. But why it still throw exceptions later on?
I've searched and checked for quite a lot of similar issues and workarounds. But it seems that neither of them help at all.

Why is Snoop for WPF crashing when we try attaching it to our application?

When I run Snoop on my WPF application, my application crashes and I get an error saying "BindingFailure was detected". The details of the error are:
The assembly with display name 'Snoop.XmlSerializers' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'Snoop.XmlSerializers, Version=2.8.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Has anybody encountered this problem before? I have no clue what's causing it.
Converting my comment into an answer:
You must have checked all exceptions in the Debug -> Exceptions dialog in Visual Studio. Uncheck all "thrown" columns

compile c# on linux with wpf

Ok, so read my question before you respond. I have a c# project that I need to compile on linux that contains WPF. I don't need to run WPF on linux, just need to compile. WPF is essentially just .net DLL's, so you think this would be doable since I'm NOT trying to run the app on linux, just build it. As far as I know I can't do this with mono compile, but I may be wrong. Maybe I can use the Microsoft compiler somehow? I don't know.
Any ideas on how I could JUST BUILD a C# app on Linux(again, I don't need to run it).
It isn't possible: http://www.mono-project.com/WPF
I have tried the simplest solution I could imagine: copy the Microsoft versions of the required assemblies (like PresentationCore.dll and PresentationFramework.dll) to a Linux box and build a simple WPF application using them.
This didn't work. I got lots of warnings about various assemblies like:
Reference 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' not resolved
Found a conflict between : 'System' and 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Using 'System' reference.
And there was the error:
CS0584: Internal compiler error: Could not import type `System.Windows.Window' from `PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
There was also one other error, but it's probably just a consequence of this error.
Based on this, I think building WPF applications using mono will not be simple, if possible at all.

Categories