Hi JB, I have a problem loading/generating .pdb file. I did not find
anything in my search.
I am using Cecil 0.94-0. First, the simple problem. I used Visual Studio
2010 to create the .dll called TaxRuntime.dll, with the .pdb file. I then
tried to open the .dll, with the following simple call:
AssemblyDefinition asm = AssemblyDefinition.ReadAssembly(
"c:\\projects\\TestCecil\\TaxRuntime\\bin\\debug\\TaxRuntime.dll", new
ReaderParameters() { ReadSymbols = true });
I got exception on line 61, PdbHelper.cs. Tracing back, I found out in
AssemblyReader.cs, line 79:
public static ModuleDefinition CreateModuleFrom (Image image,
ReaderParameters parameters)
{
var module = ReadModule (image, parameters);
After the ReadModule() call, module.FullyQualifiedName is used to figure out
the pdb file name. But FullyQualifiedName is empty, so the File.OpenRead()
on line 61 in PdbHelper.cs throws exception. So I guess somewhere in
ReadModule(), you need to populate FullyQualifiedName? Or do I need to do
something?
My goal is to create/modify both .dll and .pbd with Cecil. So far, I have
successfully created a .dll from scratch with Cecil, and I was also
successful in modifying the .dll. But I am struggling with
creating/modifying the corresponding pdb file. If I enable pbd creation in
WriteParameters, I got a file named ".pdb", I suppose this probably is
caused by the same FullyQualifiedName issue. My bigger problem is, how do I
add the source line number to IL mapping? I could not find any sample code
on the internet. We have a home grown language, we have the compiler
already, just need Cecil to write the .NET dll and pbd. For example, given
our language source code file Form1.cmp:
Form1.Field1 = 400
Form1.Field2 = 30
Form1.TOTAL = Form1.Field1 * Form1.Rate + Form1.Field2
I have 3 lines of source code in file Form1.cmp. How do I create PdbFile,
PdbSource and PdbLine, and tie them to the AssemblyDefinition and a
particular MethodDefinition? I am sure it is very simple, just could not
find any sample.
Thanks for your help.
--
--
mono-cecil