Exception of type 'System.Reflection.ReflectionTypeLoadException' was throw

-- -- 872 Reputation points
2023-03-15T18:02:33.54+00:00

Hi

Visual Studio 2022 latest. Xamarin Forms.

I am trying to debug iOS project on a connected local iPhone device. The app installs and starts on device fine but then immediately closes. I am getting below in output in Visual Studio.

[0:] An error occurred: 'Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
Could not resolve type with token 01000030 from typeref (expected class 'System.Security.Policy.EvidenceBase' in assembly 'System.Security.AccessControl, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
Could not resolve type with token 01000030 from typeref (expected class 'System.Security.Policy.EvidenceBase' in assembly 'System.Security.AccessControl, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
Could not resolve type with token 01000030 from typeref (expected class 'System.Security.Policy.EvidenceBase' in assembly 'System.Security.AccessControl, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
Could not resolve type with token 01000030 from typeref (expected class 'System.Security.Policy.EvidenceBase' in assembly 'System.Security.AccessControl, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
Could not resolve type with token 01000030 from typeref (expected class 'System.Security.Policy.EvidenceBase' in assembly 'System.Security.AccessControl, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
Could not resolve type with token 01000030 from typeref (expected class 'System.Security.Policy.EvidenceBase' in assembly 'System.Security.AccessControl, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
Could not resolve type with token 01000030 from typeref (expected class 'System.Security.Policy.EvidenceBase' in assembly 'System.Security.AccessControl, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
Could not resolve type with token 01000030 from typeref (expected class 'System.Security.Policy.EvidenceBase' in assembly 'System.Security.AccessControl, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
Could not resolve type with token 01000030 from typeref (expected class 'System.Security.Policy.EvidenceBase' in assembly 'System.Security.AccessControl, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
Could not resolve type with token 01000030 from typeref (expected class 'System.Security.Policy.EvidenceBase' in assembly 'System.Security.AccessControl, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')'. Callstack: '  at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool)
  at System.Reflection.Assembly.GetTypes () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/Assembly.cs:243 
  at Xamarin.iOS.HotRestart.Application.ForceLoadingAssemblies (System.Type formsDelegate, System.String contentFolder) <0x124916620 + 0x000d2> in <98b03165b3364c75930281f33d5e323b>:0 
  at Xamarin.iOS.HotRestart.Application.Run (System.String[] args, System.Action`1[T] loadFrameworkAction, System.Action killApplicationAction) <0x124241868 + 0x00202> in <98b03165b3364c75930281f33d5e323b>:0 '
The app has been terminated.

How can I fix this pelase?

Thanks

Regards

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,296 questions
{count} vote