Bug 19489 - Assembly loader fails to resolve type referenced from attribute
Summary: Assembly loader fails to resolve type referenced from attribute
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Reflection (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-05-02 11:47 UTC by Mikayla Hutchinson [MSFT]
Modified: 2017-10-14 00:37 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

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/4.7.49.0
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.

Note You need to log in before you can comment on or make changes to this bug.