Error running - System.TypeLoadException Invalid type SMSaml2HandlerPrivate for instance field Microsoft.IdentityModel.Tokens.Saml2SecurityTokenHandler:_smSaml2HandlerPrivateNeverSetAnyProperties
Closed this issue · 8 comments
Hi,
I cloned the repository and am running on Visual Studio 2017 on Mac. I did nuget restore. I changed the Tenant and ClientID to match the test tenant. I am getting the following error when running. Could I get any assistance or breadcrumbs to trace further?
System.TypeLoadException
Invalid type SMSaml2HandlerPrivate for instance field Microsoft.IdentityModel.Tokens.Saml2SecurityTokenHandler:_smSaml2HandlerPrivateNeverSetAnyProperties
Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): Microsoft.Owin.Security.OpenIdConnect.
Exception stack trace:
at Microsoft.Owin.Security.OpenIdConnect.OpenIdConnectAuthenticationMiddleware..ctor (Microsoft.Owin.OwinMiddleware next, Owin.IAppBuilder app, Microsoft.Owin.Security.OpenIdConnect.OpenIdConnectAuthenticationOptions options) [0x000a9] in <9676ab1309794b2396c9d7c8ad23a538>:0
at (wrapper dynamic-method) System.Object.lambda_method(System.Runtime.CompilerServices.Closure,Microsoft.Owin.OwinMiddleware,Owin.IAppBuilder,Microsoft.Owin.Security.OpenIdConnect.OpenIdConnectAuthenticationOptions)
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.Reflection/MonoMethod.cs:305
Are you working with a SAML federation provider? Please check to ensure that the location of the SAML metadata and its contents are correct.
Was under the impression it was OWIN/OpenID. Where would I check for SAML? I'll see if I can't remove the reference.
Thank you. I was able to clone and run on visual studio 2017 on windows and the sample worked within expectations. Is visual studio 2017 on Mac supported(let me know any feedback if this is an incorrect expectation with the open model). I attempted to debug and increased version levels of packages and .net framework but was unable to converge to a working combination (although did work through differing errors). Could someone more knowledgeable than I run with the configuration visual studio 2017 on Mac and let me know feedback?
Same problem here on an existing asp.net web app which runs fine on Windows. Spits out the following in the browser:
System.TypeLoadException
Invalid type SMSaml2HandlerPrivate for instance field Microsoft.IdentityModel.Tokens.Saml2SecurityTokenHandler:_smSaml2HandlerPrivateNeverSetAnyProperties
Description: HTTP 500.Error processing request.Details: Non-web exception.
Exception stack trace:
at (wrapper managed-to-native) System.RuntimeTypeHandle.is_subclass_of(intptr,intptr)
at System.RuntimeTypeHandle.IsSubclassOf (System.RuntimeType childType, System.RuntimeType baseType) [0x00016] in <4a0b6dd9ebd3408fbb54c3705bf639e9>:0
at System.RuntimeType.IsSubclassOf (System.Type type) [0x00020] in <4a0b6dd9ebd3408fbb54c3705bf639e9>:0
at System.RuntimeType.IsValueTypeImpl () [0x00026] in <4a0b6dd9ebd3408fbb54c3705bf639e9>:0
at System.Type.get_IsValueType () [0x00000] in <4a0b6dd9ebd3408fbb54c3705bf639e9>:0
at System.Type.get_IsClass () [0x0000b] in <4a0b6dd9ebd3408fbb54c3705bf639e9>:0
at System.Web.Mvc.TypeCacheUtil.TypeIsPublicClass (System.Type type) [0x00011] in :0
at System.Web.Mvc.TypeCacheUtil+<>c__DisplayClass1.b__0 (System.Type type) [0x00000] in :0
at System.Linq.Enumerable+WhereEnumerableIterator1[TSource].ToList () [0x0001b] in <7505d9a21cfc4fc7b41cb4768918fdb4>:0 at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable
1[T] source) [0x0001f] in <7505d9a21cfc4fc7b41cb4768918fdb4>:0
at System.Web.Mvc.TypeCacheUtil.GetFilteredTypesFromAssemblies (System.String cacheName, System.Predicate`1[T] predicate, System.Web.Mvc.IBuildManager buildManager) [0x0001c] in :0
at System.Web.Mvc.ControllerTypeCache.EnsureInitialized (System.Web.Mvc.IBuildManager buildManager) [0x0002b] in :0
at System.Web.Mvc.DefaultControllerFactory.GetControllerTypes () [0x0000c] in :0
at System.Web.Mvc.Routing.AttributeRoutingMapper.MapAttributeRoutes (System.Web.Routing.RouteCollection routes, System.Web.Mvc.Routing.IInlineConstraintResolver constraintResolver, System.Web.Mvc.Routing.IDirectRouteProvider directRouteProvider) [0x00056] in :0
at System.Web.Mvc.Routing.AttributeRoutingMapper.MapAttributeRoutes (System.Web.Routing.RouteCollection routes, System.Web.Mvc.Routing.IInlineConstraintResolver constraintResolver) [0x00023] in :0
at System.Web.Mvc.RouteCollectionAttributeRoutingExtensions.MapMvcAttributeRoutes (System.Web.Routing.RouteCollection routes) [0x00014] in :0
at Saksbehandler.RouteConfig.RegisterRoutes (System.Web.Routing.RouteCollection routes) [0x0000d] in :0
at Saksbehandler.MvcApplication.Application_Start () [0x00029] in :0
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0003b] in <4a0b6dd9ebd3408fbb54c3705bf639e9>:0
Version Information: 5.16.0.173 (2018-06/910395a05f6 Thu Sep 27 11:30:06 EDT 2018); ASP.NET Version: 4.0.30319.42000
Powered by Mono
I was wanting to recommit but have not had time and not quit sure all the policies. If you upgrade to ASP.Net Core and correct all dependencies it should compile
@brentschmaltz @mafurman : FYI. Is it a known issue?
@jmprieur I have not seen this before. This looks like perhaps an extension property as Saml2HandlerPrivateNeverSetAnyPropeties is not a property on m.im.tokens.saml2securitytokenhandler
Closing as we are archiving this sample.
The newer one can be found at: https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/tree/master/1-WebApp-OIDC