patchDotGNU Portable.NET - Patches: patch #3387, Fix for AssemblyBuilder.Save, fix...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #3387: Fix for AssemblyBuilder.Save, fix WriteClassToken to import class from external images

Submitter:  None
Submitted:  Fri 24 Sep 2004 07:02:54 AM UTC
   
 
Category:  None Priority:  7 - High
Status:  Done Privacy:  Public
Assigned to:  None Originator Email:  -email is unavailable-
Open/Closed:  Closed

Fri 24 Sep 2004 11:32:04 AM UTC, comment #1: 

Comitted to CVS on 24th Sept 2004.

Next time, please add your name as well to the patch info for the ChangeLog entry.

Gopal.V <t3rmin4t0r>
Group administrator
Fri 24 Sep 2004 07:02:54 AM UTC, original submission:  

Bug Description:
When saving an assembly built using Reflection.Emit,
incorrect tokens for the parameters of methods called, e.g. with callvirt, are saved.
The tokens being saved, may only be valid in the image that calls AssemblyBuilder.Save. Classes not in the image being built must be imported.

To Reproduce:
create an assembly/module/type/method with System.Reflection.Emit. In the method, generate a callvirt
instruction for a method in the executing assembly that takes some class as a parameter, for example: call (System.Collections.IList args, bool evalargs)
The saved assembly will contain an invalid token for the IList class. If the token's value is invalid in the assembly, running ildasm on the assembly will produce something like this:
metadata error in token 0x0A000001: invalid MemberRef type signature
If the token's value is valid, then you will probably see a different class than IList in the IL output.

Fix:
These invalid tokens are written in image/sig_writer.c:WriteClassToken.
Here, calling ILClassImport creates a new token that is valid in the saved assembly.
Note: ILClassImport(class) does nothing but return its argument if the class is already in the image being built.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #7893:  sig_writer-importclass.diff added by None (8KiB - text/plain - patch for cvs 2004 9-23 pnet/image/sig_writer.c)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

 

Follow 3 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2004-09-24 t3rmin4t0r StatusNone Done
    Open/ClosedOpen Closed
2004-09-24 None Attached File- Added sig_writer-importclass.diff, #3698

Back to the top

Powered by Savane 3.13-3230.
Corresponding source code