DevDefined.OAuth icon indicating copy to clipboard operation
DevDefined.OAuth copied to clipboard

TypeLoadException when assembly is picked up by MEF

Open MatthewSteeples opened this issue 11 years ago • 3 comments

I've brought in this library as a dependency of another library and all of a sudden it's generating errors when MEF analyses the assemblies for imports (it analyses all of the assemblies in the bin folder).

The error is that it doesn't like the fact that BerDecodeException.GetObjectData has different security demands than Exception.GetObjectData. Is there any reason that this SecurityPermission is required and is it possible to remove it?

System.TypeLoadException: Inheritance security rules violated while 
overriding member:
'DevDefined.OAuth.KeyInterop.BerDecodeException.GetObjectData
(System.Runtime.Serialzation.SerializationInfo,
System.Runtime.Serialization.StreamingContext)'. 

Security accessibility of the overriding method must match the security
accessibility of the method being overriden.

MatthewSteeples avatar May 15 '13 10:05 MatthewSteeples

@MatthewSteeples did you manage to find a solution to this? I'm having the same problem

paulduran avatar Jul 27 '13 14:07 paulduran

I'm afraid in the end what I did was I excluded this assembly from being analysed by MEF. I never had chance to work out why the error was appearing.

MatthewSteeples avatar Jul 27 '13 18:07 MatthewSteeples

@MatthewSteeples No worries, I ended up taking the same approach...

paulduran avatar Jul 31 '13 01:07 paulduran