简体   繁体   中英

How can I debug dll if loaded in advance using visual studio 2015

I am working on one wpf application. I am loading all dlls in advance in BootLoader method. when I put breakpoint inside one of my dll. I cannot debug, My breakpoints did not hit and breakpoint does not seems to be disable too.

All options are correct. Even modules tab shows symbols loaded and assembly's pdb file is in same location

在此处输入图片说明

    private readonly ConcurrentDictionary<string, Assembly> _libs;
           public App()
           {
                _libs = new ConcurrentDictionary<string, Assembly>();
                BootLoader();
           }
 private void BootLoader()
        {
            Assembly a;
            foreach (var dll in new DirectoryInfo(System.AppDomain.CurrentDomain.BaseDirectory + @"\..\..\").GetFiles("*.dll", SearchOption.AllDirectories))
            {
                if (!_libs.TryGetValue(dll.Name, out a))
                {
                    if (!_libs.TryAdd(dll.Name, Assembly.LoadFile(dll.FullName)))
                    {
                        Logger.Error($"CurrentDomain_AssemblyResolve: could not add {dll.Name} in assembly list");
                    }
                }
            }

Please Assist.

确保每个程序集的pdb文件位于同一位置。

When we start debug our application in Visual Studio, Visual Studio will try load all assembly symbol files before all breakpoints hit. So you problem is not related to the Symbol files loading.

Please make sure you are in Debug mode , not in Release mode when you start debugging first. And according to the sample code you provided, there has any condition in the BootLoader() method. Please make sure the breakpoint you added is satisfied with the If condition statement or out of the condition statement block.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM