Get the original source code location for an assembly

后端 未结 1 1329
-上瘾入骨i
-上瘾入骨i 2020-12-19 11:31

Is there a way to obtain the location of an assembly\'s original source code location through reflection?

Warning, I\'m not looking

相关标签:
1条回答
  • 2020-12-19 12:36

    That information is stored in the .PDB file. There are two basic flavors of it, the full one that you get from a Debug build and the stripped one that you get by default from the Release build. A stripped .PDB has the file and line number info removed. Pretty specifically to remove details that most companies consider proprietary.

    Project + Properties, Build tab, Advanced button, Debug Info sets this. "Full" is the normal Debug build setting, "pdb-only" is the default Release build setting that produces the stripped version.

    Reading the .PDB file is supported by the DbgHelp api, the native flavor. The DIA SDK provides a friendlier COM wrapper for it and the usual choice from C#. The CLR uses it too, that's how you can see the file+line in an exception's stack trace.

    0 讨论(0)
提交回复
热议问题