Bug 315208 (MONO60519) - [PATCH] Assembly.GetReferencedAssemblies doesn't return the public key token
Summary: [PATCH] Assembly.GetReferencedAssemblies doesn't return the public key token
Status: RESOLVED FIXED
Alias: MONO60519
Product: Mono: Runtime
Classification: Mono
Component: misc (show other bugs)
Version: unspecified
Hardware: Other All
: P3 - Medium : Major
Target Milestone: ---
Assignee: Sebastien Pouliot
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-22 03:59 UTC by Sebastien Pouliot
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
icall.diff (2.26 KB, patch)
2004-06-22 17:46 UTC, Thomas Wiest
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 18:43:28 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)