Hi,

It seems Cecil (latest svn) has problems to handle try-catch blocks
with generic exception handling correctly.

Test case:

public class MyCustomException<T> : Exception { }

public class TestClass
{
    void TestCase()
    {
        try
        {
            ((int)1).ToString();//dummy code
        }
        catch (MyCustomException<TestClass>)
        {
            throw;
        }
    }
}

Now if I compile the code above I am not able to load the assembly,
save the assembly and load the saved assembly again:

AssemblyDefinition ad = AssemblyFactory.GetAssembly(@"C:\
\TestLib.dll");
AssemblyFactory.SaveAssembly(ad, "C:\\TestLibSaved.dll");
AssemblyFactory.GetAssembly("C:\
\TestLibSaved.dll").MainModule.FullLoad(); //exception is thrown by
Mono.Cecil.Cil.CodeReader.ReadExceptionHandlerEnd(ExceptionHandler eh,
BinaryReader br, MethodBody body)

I uploaded the compiled code as well (TestLib.zip)

Regards - Gordon
--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---

Reply via email to