Hey there!
When MethodCallWithSubsetLinkDemandRule is run against
Test.Rules.Security.MethodCallWithSubsetLinkDemandTest/
SubsetInheritClass::VirtualMethod(), it crashes with a
NotImplementedException:
An uncatched exception occured. Please fill a bug report @
https://bugzilla.novell.com/
Rule: Gendarme.Rules.Security.MethodCallWithSubsetLinkDemandRule
Target: System.Void
Test.Rules.Security.MethodCallWithSubsetLinkDemandTest/
SubsetInheritClass::VirtualMethod()
Stack trace: System.NotImplementedException: The requested feature is
not implemented.
at Mono.Cecil.SecurityDeclaration.Resolve () [0x00000]
at
Gendarme.Rules.Security.MethodCallWithSubsetLinkDemandRule.GetLinkDemand
(Mono.Cecil.MethodDefinition method) [0x00000]
at Gendarme.Rules.Security.MethodCallWithSubsetLinkDemandRule.Check
(Mono.Cecil.MethodDefinition caller, Mono.Cecil.MethodDefinition
callee) [0x00000]
at
Gendarme.Rules.Security.MethodCallWithSubsetLinkDemandRule.CheckMethod
(Mono.Cecil.MethodDefinition method) [0x00000]
at Gendarme.Framework.Runner.OnMethod
(Gendarme.Framework.RunnerEventArgs e) [0x00000]
at Gendarme.Framework.Runner.Run () [0x00000]
at Gendarme.ConsoleRunner.Run () [0x00000]
at Gendarme.ConsoleRunner.Execute (System.String[] args) [0x00000]
I believe it happens because the rule code calls[1] the
SecurityDeclaration::Resolve() method, and it seems[2] to be left with
no implementation.
^ [1]: <MethodCallWithSubsetLinkDemandRule.cs>
(Gendarme.Rules.Security)
48: case Mono.Cecil.SecurityAction.NonCasLinkDemand:
49: declsec.Resolve ();
50: return declsec.PermissionSet;
51: }
^ [2]: <SecurityDeclaration.cs> (Cecil)
103: public bool Resolve ()
104: {
105: throw new NotImplementedException ();
106: }
I don't understand the security matters (maybe there's a reason why
there's no implementation), yet Gendarme rules should not throw
exceptions so this is certainly a bug (either in Gendarme or Cecil).