Bug 639 - InternalsVisibleTo attribute pointing to missing assembly causes compilation failure
Summary: InternalsVisibleTo attribute pointing to missing assembly causes compilation ...
Status: RESOLVED NORESPONSE
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Linux
: Normal major
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2011-09-05 12:07 UTC by Sean McCleary
Modified: 2012-02-27 05:26 UTC (History)
3 users (show)

Tags:
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:
Status:
RESOLVED NORESPONSE

Description Sean McCleary 2011-09-05 12:07:06 UTC
When the AssemblyInfo.cs file has InternalsVisibleTo attributes, but the assembly mentioned therein is not present, the compilation fails.

Happens reliably on with Mono 2.10.4, when using the MySql.Data.dll 6.4.3 assembly, like so:

dmcs -r:MySql.Data.dll test.cs

Produces the below stack strace.  MySql.Data.dll, as distributed from MySql, has the internals visible to MySql.Data.Tests and MySql.Data.CF.Tests, neither of which are distributed with the download.

Getting the source for the MySql .net connector, removing those attributes from the AssemblyInfo.cs, and compiling, gave me a dll that works just fine with mono.

-------------------

Unhandled Exception: System.IO.FileLoadException: The assembly name is invalid.
  at System.Reflection.AssemblyName..ctor (System.String assemblyName) [0x00045] in /home/sean/build/mono-2.10.4/mcs/class/corlib/System.Reflection/AssemblyName.cs:93 
  at Mono.CSharp.ImportedAssemblyDefinition.ReadAttributes () [0x000c5] in /home/sean/build/mono-2.10.4/mcs/mcs/import.cs:1522 
  at Mono.CSharp.MetadataImporter.GetAssemblyDefinition (System.Reflection.Assembly assembly) [0x00028] in /home/sean/build/mono-2.10.4/mcs/mcs/import.cs:821 
  at Mono.CSharp.ReflectionImporter.ImportAssembly (System.Reflection.Assembly assembly, Mono.CSharp.RootNamespace targetNamespace) [0x00000] in /home/sean/build/mono-2.10.4/mcs/mcs/reflection.cs:88 
  at Mono.CSharp.DynamicLoader.LoadReferences (Mono.CSharp.ModuleContainer module) [0x0003e] in /home/sean/build/mono-2.10.4/mcs/mcs/reflection.cs:587 
  at Mono.CSharp.Driver.Compile () [0x00159] in /home/sean/build/mono-2.10.4/mcs/mcs/driver.cs:1535 
  at Mono.CSharp.Driver.Main (System.String[] args) [0x0003d] in /home/sean/build/mono-2.10.4/mcs/mcs/driver.cs:243 
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileLoadException: The assembly name is invalid.
  at System.Reflection.AssemblyName..ctor (System.String assemblyName) [0x00045] in /home/sean/build/mono-2.10.4/mcs/class/corlib/System.Reflection/AssemblyName.cs:93 
  at Mono.CSharp.ImportedAssemblyDefinition.ReadAttributes () [0x000c5] in /home/sean/build/mono-2.10.4/mcs/mcs/import.cs:1522 
  at Mono.CSharp.MetadataImporter.GetAssemblyDefinition (System.Reflection.Assembly assembly) [0x00028] in /home/sean/build/mono-2.10.4/mcs/mcs/import.cs:821 
  at Mono.CSharp.ReflectionImporter.ImportAssembly (System.Reflection.Assembly assembly, Mono.CSharp.RootNamespace targetNamespace) [0x00000] in /home/sean/build/mono-2.10.4/mcs/mcs/reflection.cs:88 
  at Mono.CSharp.DynamicLoader.LoadReferences (Mono.CSharp.ModuleContainer module) [0x0003e] in /home/sean/build/mono-2.10.4/mcs/mcs/reflection.cs:587 
  at Mono.CSharp.Driver.Compile () [0x00159] in /home/sean/build/mono-2.10.4/mcs/mcs/driver.cs:1535 
  at Mono.CSharp.Driver.Main (System.String[] args) [0x0003d] in /home/sean/build/mono-2.10.4/mcs/mcs/driver.cs:243
Comment 1 Rolf Bjarne Kvinge [MSFT] 2012-01-20 17:14:54 UTC
=> C# compiler
Comment 2 Marek Safar 2012-01-27 09:42:39 UTC
I cannot reproduce it, it looks like you have some special assembly name. Can you provide sample code which reproduces the problem.
Comment 3 Marek Safar 2012-02-27 05:26:47 UTC
No response