"modifying the pdb file to match with the modified assembly" is exactly 
what I am looking for. I tried the solution in the given link and I was 
able to create a matched pair of assembly and pdb file (checked by a tool 
called "chkmatch").

However, I have some "follow-up" problems:

First, I did nothing in the "make required changes" section (as shown in 
the following code snippet) --- in other words, I just read the assembly 
and write it back without making any change to it. But the new pdb file is 
smaller than the original one (although the size of modified assembly does 
not change). What is missing inside?

var readerParameters = new ReaderParameters { ReadSymbols = true };
var assemblyDefinition = AssemblyDefinition.ReadAssembly (fileName, 
readerParameters);

// make required changes.

var writerParameters = new WriterParameters { WriteSymbols = true };
assemblyDefinition.Write (outputFile, writerParameters);

Second, I tried to collect coverage information by running a test suite on 
the new assembly along with the new pdb, in a VS2010 test project using 
MSTest, but I failed to add the new assembly when I setting up the test 
configuration. The error message is "Cannot obtain the symbols information 
for the binary ... Please ensure that both the binary and the symbols files 
are accessible."... -- I doubt this was caused by the first issue.

Could anyone help on this?

Thanks in advance!


On Monday, March 28, 2011 11:35:10 AM UTC-4, ShdNx wrote:
>
> Oh, nevermind that last, I'm just dumb. I missed the part that 
> Mono.Cecil.Pdb will be tried to be used under Windows, and Mono.Cecil just 
> apparently failed silently when I didn't have dll referenced. Really should 
> cause an exception!
>
> Thanks for your help! Works perfectly now!
>
> (Haha, just received your e-mail telling the same. Thanks for coping with 
> stupid users like myself. :))
>
> 2011/3/28 Gábor Kozár <[email protected]>
>
>> I've tried that, but the result is the same. I mean, literally: getting 
>> no pdb file generated, even though I've set both the ReadSymbols and 
>> WriteSymbols properties, and I have Mono.Cecil.Mdb.dll referenced. The 
>> output .exe is written fine, but no pdb. I get no errors or exceptions.
>>
>> My corresponding lines are exactly the same as on your wiki. Any hints?
>>
>> 2011/3/28 Jb Evain <[email protected]>
>>
>>> Hi,
>>>
>>> On Mon, Mar 28, 2011 at 4:24 PM, Gábor Kozár <[email protected]> 
>>> wrote:
>>> > As far as I know Mono.Cecil is capable of altering symbol files. Could
>>> > somebody point me into the right direction with this?
>>>
>>> https://github.com/jbevain/cecil/wiki/Debug-symbols
>>>
>>> Jb
>>>
>>> --
>>> --
>>> mono-cecil
>>
>>
>>
>

-- 
--
mono-cecil

Reply via email to