Thanks, I grabbed the latest version.

I still can't get it to do symbols.

I have:
            var inputAssemblyStream = new
MemoryStream(File.ReadAllBytes("MyAssembly.dll");
            var inputSymbolStream = new
MemoryStream(File.ReadAllBytes("MyAssembly.pdb");

            AssemblyDefinition assemblyDefinition =
AssemblyDefinition.ReadAssembly(inputAssemblyStream, new
ReaderParameters(ReadingMode.Immediate) { ReadSymbols = true,
SymbolStream = inputSymbolStream });

           //   ...do stuff

            var outputAssemblyStream = new MemoryStream();
            var outputSymbolStream = new MemoryStream();

            assemblyDefinition.Write(outputAssemblyStream, new
WriterParameters { WriteSymbols = includeSymbols, SymbolStream =
outputSymbolStream });

            // outputSymbolStream has a length of 0 here...I don't
think it should...
            // outputAssemblyStream looks good size wise.

Any suggestions? Thanks!

On Nov 11, 7:34 pm, Jb Evain <[email protected]> wrote:
> According to the code, you're using Cecil 0.6. I suggest you use 0.9
> fromhttp://github.com/jbevain/ceciland 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().Lo 
> > cation));
>
> > 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