Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xamarin.Mac - PCLStorage.dll Could Not Load "Systems.Windows.Forms" #37

Open
Sparksteam opened this issue Apr 1, 2016 · 2 comments
Open

Comments

@Sparksteam
Copy link

I built a Xamarin.Mac test app which targets Xamarin.Mac, .NET 4.5 which references a Xamarin.Mac class library which targets the same. The library pulls in the latest, stable PCLStorage NuGet from NuGet.org. But when I run the app, I get an immediate System.IO.FileNotFoundException in Main() with this message.

Could not load file or assembly 'System.Windows.Forms' or one of its dependencies.

I've commented out most of the code in the library and I believe I've isolated the offending statement to this line.

var folder = FileSystem.Current.LocalStorage;

When it fails, the last line in the Application Output window shows

Loaded assembly..../MonoBundle/PCLStorage.dll [External]

If I comment the line out, the app starts up just fine and the Output does NOT show PCLStorage.dll being loaded at all. PCLStorage.Abstractions.dll [External] loads with no problems.

I'm running Xamarin Studio 5.10.3 (build 51) with Xamarin.Mac Version 2.4.2.1 (Xamarin Enterprise), and a colleague can reproduce the same problem in their dev environment running the same project.

No problem on iOS, Android, and Windows.

I've been debugging this for days now. Do you have a clue as to what my problem might be?

Thanks

@dsplaisted
Copy link
Owner

I think Xamarin.Mac ends up using the .NET 4.5 version of PCL Storage. So it blows up at this line:

var localAppData = System.Windows.Forms.Application.LocalUserAppDataPath;

See also #28.

@Sparksteam
Copy link
Author

Strange Daniel...

When I changed the Target Framework of just the Xamain.Mac app to Mono/.NET 4.5 it worked. When I changed it back to Xamarin.Mac .NET 4.5 it also worked.

Something got nudged during the toggle, but what's inexplicable is nothing discernable changed in the .csproj file.

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants