Bugzilla – Bug 315208
[PATCH] Assembly.GetReferencedAssemblies doesn't return the public key token
Last modified: 2007-09-15 21:24:46 UTC
---- Reported by sebastien@ximian.com 2004-06-21 20:59:58 MST ---- Description of Problem: Assembly.GetReferencedAssemblies doesn't return the public key token. Component is "runtime" because the method is an icall. Steps to reproduce the problem: 1. Compile this source code using System; using System.Reflection; public class AssemblyReference { public static void Main (string[] args) { Assembly main = Assembly.Load (args [0]); AssemblyName[] refs = main.GetReferencedAssemblies (); for (int i=0; i < refs.Length; i++) { AssemblyName an = refs [i]; Console.WriteLine (an.FullName); } } } 2. Execure with "System.Xml" as it's parameter Actual Results: # mono assref.exe System.Xml mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=null System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=null Expected Results: Public key token shouldn't be null. How often does this happen? Always Additional Information: The culture and public key token aren't copied in ves_icall_System_Reflection_Assembly_GetReferencedAssemblies (icall.c) ---- Additional Comments From sebastien@ximian.com 2004-06-21 21:34:49 MST ---- It seems that MonoAssembly *assem = assembly->assembly->image->references [i]; doesn't have the public key token information either, so adding the copy code isn't enough. It may be related to #60439 where the public key token is also missing for custom attributes. ---- Additional Comments From sebastien@ximian.com 2004-06-21 22:01:07 MST ---- It seems that the public key token is created, in the AssemblyName, before loading assemblies but is "lost" (i.e. not copied) after the assembly is loaded (Assembly->AssemblyName). ---- Additional Comments From sebastien@ximian.com 2004-06-22 09:17:28 MST ---- Unrelated to #60439. ---- Additional Comments From sebastien@ximian.com 2004-06-22 10:46:06 MST ---- icall wasn't copying every fields. ---- Additional Comments From sebastien@ximian.com 2004-06-22 10:46:28 MST ---- Created an attachment (id=166298) icall.diff ---- Additional Comments From duncan@ximian.com 2004-06-22 15:37:09 MST ---- This is a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO59218 It looks like this patch is more complete than the one I wrote, I'll mark 59218 as a duplicate of this one. ---- Additional Comments From duncan@ximian.com 2004-06-22 15:37:20 MST ---- *** https://bugzilla.novell.com/show_bug.cgi?id=MONO59218 has been marked as a duplicate of this bug. *** ---- Additional Comments From sebastien@ximian.com 2004-06-22 17:14:09 MST ---- Fixed in CVS. Imported an attachment (id=166298)