vishal
vishal

Reputation: 616

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

enter image description here

    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.

Upvotes: 1

Views: 1232

Answers (2)

Leo Liu
Leo Liu

Reputation: 76740

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.

Upvotes: 0

mrjoltcola
mrjoltcola

Reputation: 20842

Make sure each assembly's pdb file is in same location.

Upvotes: 1

Related Questions