android: Could not load assembly 'System.Security.Permissions' during startup registration.

Steps to Reproduce

  1. create Xamarin.Forms app with VS2017 (that uses Asp.Net Core SignalR)
  2. try do debug the Android app

Expected Behavior

app starts fine and can be debugged.

Actual Behavior

App crashes at startup and in Output/Debug I see the following:

[08-17 08:09:21.513 D/Mono    (17682): Assembly Loader probing location: 'System.Security.Permissions'.
08-17 08:09:21.513 F/monodroid-assembly(17682): Could not load assembly 'System.Security.Permissions' during startup registration.
08-17 08:09:21.513 F/monodroid-assembly(17682): This might be due to an invalid debug installation.
08-17 08:09:21.513 F/monodroid-assembly(17682): A common cause is to 'adb install' the app directly instead of doing from the IDE.

Version Information

Microsoft Visual Studio Enterprise 2017 
Version 15.8.0
VisualStudio.15.Release/15.8.0+28010.0
Microsoft .NET Framework
Version 4.7.03062

Xamarin   4.11.0.732 (d15-8@33e83e124)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   4.14.218 (79f535bdd)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Live Reload   0.4.0 (remotes/origin/dev@75526a0)
Provides live reload capabilities for Xamarin XAML.

Xamarin Templates   1.1.113 (e1d02a7)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   9.0.0.18 (HEAD/3d8a28f1a)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK   11.14.0.13 (373c313)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

I also played with settings for Mono Shared Runtime/Linking/apk per ABi, installed OpenJDK, but nothing helps.

The strange thing is that I was able to build/launch the app in the 15.8 preview 5 without any issues and now in the 15.8 stable I have the issues again like in 15.7.x.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 31 (1 by maintainers)

Most upvoted comments

@MagicAndre1981 sorry, thought I have replied to this. It does, but TinyIoC doesn’t have the dependencies that Castle has, so I don’t think it’s related. It worked even back when PackageReference didn’t work with Castle installed.

@MagicAndre1981 No, I haven’t. I tried ~Preview 2 with no success. I will try it again once we have the official release in April.