According to the code, you're using Cecil 0.6. I suggest you use 0.9
from http://github.com/jbevain/cecil and that you use:

https://github.com/jbevain/cecil/wiki/Debug-symbols

On Thu, Nov 11, 2010 at 11:57 PM, Jeff Nevins <[email protected]> wrote:
> I can't seem to get my modified assembly to retain debug info.
>
> The app is built in debug mode and all the pdbs are available. Before
> the assembly I modify is loaded into the AppDomain, I do (in the entry
> assembly)
>
>        public static void Weave()
>        {
>            const string fileName = "SomeDll.dll";
>            var data = Weaver.Weave(File.ReadAllBytes(fileName));
>            File.WriteAllBytes(fileName, data);
>        }
>
> and my Weaver:
>
>        public static byte[] Weave(byte[] assemblyData)
>        {
>            var weavedAssembly =
> Weave(AssemblyFactory.GetAssembly(assemblyData)); // does
> modifications
>            AssemblyFactory.SaveAssembly(weavedAssembly, out
> assemblyData);
>            return assemblyData;
>        }
>
> After WriteAllBytes gets called, when the assembly is subsequently
> loaded, none of my breakpoints get hit and I can't debug the code in
> that assembly.
>
> It makes sense, since the symbols would be different after the
> modification, but if I try:
>
>
> module.SaveSymbols(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
>
> I subsequently get
>
> "Specified method is not supported."
>
> trying to call
>
> AssemblyFactory.SaveAssembly(weavedAssembly, out assemblyData);
>
> I think I'm just doing something stupid wrong here...
>
> Thanks in advance.
>
> --
> --
> mono-cecil

-- 
--
mono-cecil

Reply via email to