Error round-tripping assembly

View: New views
2 Messages — Rating Filter:   Alert me  

Error round-tripping assembly

by JohnC-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I have uploaded a file rapptor.zip which contains a
rapptor.persistence.dll assembly. Cecil cannot round trip the assembly
correctly.

Here is code to reproduce the error:

            try
            {

                AssemblyDefinition ad = AssemblyFactory.GetAssembly
(@"c:\RAPPTOR.Persistence.dll");
                AssemblyFactory.SaveAssembly(ad, @"c:\output
\RAPPTOR.Persistence.dll");

                Assembly a = Assembly.LoadFile(@"c:\output
\RAPPTOR.Persistence.dll");
                a.GetTypes();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                ReflectionTypeLoadException rtle = ex as
ReflectionTypeLoadException;

                if (rtle != null)
                {
                    foreach (Exception ee in rtle.LoaderExceptions)
                    {
                        MessageBox.Show(ee.ToString());
                    }
                }
            }
--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---


Re: Error round-tripping assembly

by JohnC-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Dear Jb,

Upon further research, I found that if I disassemble the assembly
using ildasm and remove the generic parameter constraints and then re-
assembly and round-tripping, the error does not occur.

FYI, there are 5 instances where generic parameters are constrained -
they are all in the 'RAPPTOR.Persistence.DataModel.REF' namespace  and
all the constraints are "where T : ManagedObject".

Hope this will information will help in trouble-shooting the issue.

Let me know if there is anything I can do or if you need more info.





On Aug 26, 11:49 am, JohnC <john.cro...@...> wrote:

> I have uploaded a file rapptor.zip which contains a
> rapptor.persistence.dll assembly. Cecil cannot round trip the assembly
> correctly.
>
> Here is code to reproduce the error:
>
>             try
>             {
>
>                 AssemblyDefinition ad = AssemblyFactory.GetAssembly
> (@"c:\RAPPTOR.Persistence.dll");
>                 AssemblyFactory.SaveAssembly(ad, @"c:\output
> \RAPPTOR.Persistence.dll");
>
>                 Assembly a = Assembly.LoadFile(@"c:\output
> \RAPPTOR.Persistence.dll");
>                 a.GetTypes();
>             }
>             catch (Exception ex)
>             {
>                 MessageBox.Show(ex.ToString());
>                 ReflectionTypeLoadException rtle = ex as
> ReflectionTypeLoadException;
>
>                 if (rtle != null)
>                 {
>                     foreach (Exception ee in rtle.LoaderExceptions)
>                     {
>                         MessageBox.Show(ee.ToString());
>                     }
>                 }
>             }
--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---