I have a C++ application. When i press F5 in visual studio application starts and i can debug it. But when I run application from windows explorer and then attach this process in visual studio I see breakpoints can be hit (they are completely red) but breakpoint does not hit. When I see modules window nothing is present there. What is problem?
Asked
Active
Viewed 2.3k times
2 Answers
33
Verify the code type Visual Studio is configured to load symbols. Attach To Process dialog has Select Code Type option to specify which symbols to load. Here you can select Managed symbols and/or Native symbols.
Also the assemblies should be of same version.

jags
- 2,022
- 26
- 34
-
i has selected automatically detrmine option in attach to process, is it ok or i have to tell it explicitly that i have to choose native or managed, – fhnaseer Oct 15 '12 at 08:01
-
3Try changing it to other options e.g. Managed v4.0 and/or native. – jags Oct 15 '12 at 08:03
-
I selected Managed V4 and Native code, and now it is working fine. Can you tell me why automatic selection was not working fine? – fhnaseer Oct 15 '12 at 08:03
-
Not sure actually, will do some research and share if find anything, but I faced similar error some time before and resolved by changing the Code Type. – jags Oct 15 '12 at 08:04
-
@jags Have you got the reason? I got the same problem and work out by selecting code types. – stackunderflow Jul 08 '14 at 12:21
-
Thanks @jags, you see, a lot of developers didn't even hear about managed and native code types – Karim AG Sep 16 '15 at 12:13
-
Oh man, this answer made my day. My visual studio hasn't been properly attaching to things for weeks. It would act like it attached fine but no symbols would be loaded and break threw an error. Turns out code type got set to CoreCLR at some point. Changed it back to automatic and everything works now. – Wearwolf Mar 31 '16 at 16:35
0
It sounds like the executable code that you are debugging (F5) is not the same as the one you are running from explorer. Check the date of the executable you are running. Also, it may be picking up a different version of DLL if you are using them. Try renaming one of your DLL files and then running from explorer. Use depends.exe to see which modules are being loaded.

Blazes
- 4,721
- 2
- 22
- 29
-
date is the same, when i run application with debugger then in attach to process it is saying "x86", but when i run it through windows explorer attach to process explorer says it is "managed (v4), x86" – fhnaseer Oct 15 '12 at 07:57