How the CLR locates pdb symbol files

三世轮回 提交于 2019-12-03 06:56:10

You could simply set the _NT_SYMBOL_PATH environment variable for your own process. This worked well:

using System;
using System.Runtime.CompilerServices;
using System.Reflection;
using System.IO;

class Program {
    static void Main(string[] args) {
        var path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
        path = Path.Combine(path, "symbols");
        Environment.SetEnvironmentVariable("_NT_SYMBOL_PATH", path);
        try {
            Kaboom();
        }
        catch (Exception ex) {
            Console.WriteLine(ex.ToString());
        }
        Console.ReadLine();
    }
    [MethodImpl(MethodImplOptions.NoInlining)]
    static void Kaboom() {
        throw new Exception("test");
    }
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!