[Mono-dev] Changing an assembly loaded with ReflectionOnlyLoadFrom

David McFarland corngood at gmail.com
Sun Dec 23 18:18:05 UTC 2012


I just reported this bug on monodevelop, but I'm seeing some scary
stuff inside mono itself:

https://bugzilla.xamarin.com/show_bug.cgi?id=9124

As part of the build process, MSBuild loads a dependent assembly with
ReflectionOnlyLoadFrom to determine it's referenced assemblies.  If
you then structurally change the assembly on disk, and do another
build, you get garbage inside GetReferencedAssemblies() like this:
Normally:

---------------------------
Breakpoint 1, ves_icall_System_Reflection_Assembly_GetReferencedAssemblies
(assembly=<optimized out>) at icall.c:4506
4506                            args [0] = mono_string_new (domain,
mono_metadata_string_heap (image, cols [MONO_ASSEMBLYREF_CULTURE]));
2: count = 2
1: cols = {4, 0, 0, 0, 0, 8140, 26646, 0, 0}
---------------------------

After Changing the Assembly:
---------------------------
Breakpoint 1, ves_icall_System_Reflection_Assembly_GetReferencedAssemblies
(assembly=<optimized out>) at icall.c:4506
4506                            args [0] = mono_string_new (domain,
mono_metadata_string_heap (image, cols [MONO_ASSEMBLYREF_CULTURE]));
2: count = 2
1: cols = {1533, 17340, 1, 512, 1138361855, 1, 512, 1537, 17395}
---------------------------

Which causes it (usually) to try to create a CultureInfo with some
random string data.

This is on linux, btw.  Maybe on windows the file would be locked?


More information about the Mono-devel-list mailing list