Bug 19489

Summary: Assembly loader fails to resolve type referenced from attribute
Product: [Mono] Runtime Reporter: Mikayla Hutchinson [MSFT] <mhutch>
Component: ReflectionAssignee: Bugzilla <bugzilla>
Severity: normal CC: kumpera, mono-bugs+runtime
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:

Description Mikayla Hutchinson [MSFT] 2014-05-02 11:47:45 UTC
The Mono runtime fails to load a MSBuild task because it fails to correctly load an attribute of the form [SourceAnalyzer(typeof(CsParser))].

To repro:

1. Download http://packages.nuget.org/api/v1/package/StyleCop.MSBuild/
2. Rename nupkg to zip and extract
3. cd stylecop.msbuild.4.7.49/tools
4. Use csharp shell:

csharp> LoadAssembly ("StyleCop.dll") 
csharp> new StyleCop.StyleCopTask ().Execute ()
Cannot load type 'StyleCop.CSharp.CsParser, StyleCop.CSharp, Version=4.7.1000.0, Culture=neutral, PublicKeyToken=f904653c63bc2738'
System.ArgumentNullException: parserType
Parameter name: Must not be null
  at StyleCop.Param.RequireNotNull (System.Object parameter, System.String parameterName, StyleCop.ParamErrorTextHandler errorTextHandler) [0x00000] in <filename unknown>:0 
  at StyleCop.Param.RequireNotNull (System.Object parameter, System.String parameterName) [0x00000] in <filename unknown>:0 
  at StyleCop.SourceAnalyzerAttribute..ctor (System.Type parserType) [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.MonoCustomAttrs:GetCustomAttributesInternal (System.Reflection.ICustomAttributeProvider,System.Type,bool)
  at System.MonoCustomAttrs.GetCustomAttributesBase (ICustomAttributeProvider obj, System.Type attributeType, Boolean inheritedOnly) [0x00000] in <filename unknown>:0 
  at System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType, Boolean inherit) [0x00000] in <filename unknown>:0 
  at System.MonoType.GetCustomAttributes (System.Type attributeType, Boolean inherit) [0x00000] in <filename unknown>:0 
  at StyleCop.StyleCopCore.GetNextAddInAttributeType (System.Type addInType, System.Type attributeType, System.Object& attribute) [0x00000] in <filename unknown>:0 
  at StyleCop.StyleCopCore.InitializeAddIn (System.Type addInType, Boolean isKnownAssembly) [0x00000] in <filename unknown>:0 
  at StyleCop.StyleCopCore.LoadAddins (System.String path, System.Byte[] publicKey) [0x00000] in <filename unknown>:0
Comment 1 Rodrigo Kumpera 2017-10-14 00:37:38 UTC
I tested this with master and it works.