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:
[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