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

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

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.