Hi again!

Sorry for disturbing you again, but I probably need something else to
make this work.

Let me show you what actually works with regards to loading the
assembly and the symbols as a byte array.


            var assemblyArray = File.ReadAllBytes("MyLibrary.dll");
            var pdbArray = File.ReadAllBytes("MyLibrary.pdb");

            Assembly assembly = Assembly.Load(assemblyArray,pdbArray);

When trying to invoke a method the breakpoint is hit and everything
works fine.

The number of bytes return from ReadAllBytes is 4096.


Now lets put Cecil to work.

All I do is open up the assembly using GetAssembly and then save it as
a byte array using SaveAssembly.

This is done in a custom class(loader) that performs this in a
secondary application domain.

So the calling code is altered to:

            var assemblyArray =  loader.LoadAssembly("MyLibrary.dll");
            var pdbArray = File.ReadAllBytes("MyLibrary.pdb");

            Assembly assembly = Assembly.Load(assemblyArray,pdbArray);

I have not altered the assembly in any way and the number of bytes
returned is exactly the same(4096).

Now if I invoke the method the breakpoint is no longer hit.

The may be a variety of reason why, but it seems like I need to do
LoadSymbols after the GetAssembly call.

But then I need some way to retrieve the symbols byte array.

What do you think?

Regards


Bernhard
























On Apr 24, 10:51 am, Jb Evain <[email protected]> wrote:
> Hey,
>
> On 4/24/09, seesharper <[email protected]> wrote:
>
> >  Would it be possible to just mark my injected IL as hidden (16707566
> >  is 0xfeefee in hexa)?
>
> You certainly can.
>
> >  Would that maybe remove the need to update the sequence points in the
> >  first place?
>
> Am not sure you *need* to update the sequence points, as long as you
> don't modify them, the debugger will just skip over the newly inserted
> IL.
>
> --
> Jb Evain  <[email protected]>
--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---

Reply via email to