Unable to step into 3rd party code using debugger - visual-studio-debugging

I want to step into the DevExpress XAF code using the debugger.
I have asked about it here but am having problems spotting what I have done wrong.
VS2019 16.2.2
Dev Express XAF 19.1.5 Winforms project
The break point is in Program.cs
at
winApplication.Start
which is in
DevExpress.ExpressApp.Win.WinApplication
I downloaded the .pdb files and set up the Symbols
I un-checked Tools->Options->Debugging->Enable Just My Code
At the breakpoint Debug->Windows->Modules shows that the Symbol file for mscorlib.dll is loaded.
Exception settings are
[Update]
Lance Li pointed out the cannot find or open the pdb file message
When I select Symbol Load Information it mentions the location is
C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\DevExpress.Utils.v19.1\v4.0_19.1.5.0__b88d1754d700e49a\DevExpress.Utils.v19.1.pdb: Cannot find or open the PDB file.
I tried clicking the load all symbols button in the symbols screen but it did not help.
I attempted to locate the pdb but got a message
A matching symbol file was not found in this folder
I tried suspending Resharper and that did not help.
[Update]
I noticed that it is looking for the file in the GAC
I see that there is a copy of mscorlib.pdb in d:\pdb\19.1
Could it be that that somehow re-arranges something to expect to find the Dev Express .pdbs in the GAC?
The source code is on GitHub
[Update]
In the DevExpress question Dennis points out that when he hits F11 Visual Studio asks for a source code path. I think this happened once for me I have selected the default path. Now Visual Studio no longer asks.
I tried re-cloning the application but it did not help.
I tried opening up with VS2017 but that did not help.
[Update]
I installed on to a different computer
then at the break point I received a dialog box to select the source code.
I located the source at
Directory of C:\Program Files (x86)\DevExpress 19.1\Components\Sources\DevExpress.ExpressApp\DevExpress.ExpressApp\DevExpress.Persistent.Base
Then I was able to step through the Dev Express code on the second computer.
Now to figure out how to correct the behaviour on the first computer.
[Update]
I was able to get the Find Source dialog up by the following method.
Run to the break point , then select Debug -> Windows -> Modules.
Then right click an unloaded module and un-check Always Load Automatically.
After that when I ran again I got the dialog allowing me to locate the source.

My problem was that Visual Studio was looking in the wrong place for the source.
Further to that, because it had been told to look in the wrong place automatically then I did not receive a dialog asking me to locate the source.
So as to receive the Find Source Dialog , the trick was to unckeck the Always Load Automatically option.
To get at this option, I ran to the break point and then selected Debug -> Windows -> Modules. Then right clicked an unloaded module and un-checked Always Load Automatically.
A different way could have been to add the correct path to the Solution->Properties->Common Properties-> Directories Containing Source Code

Related

Visual studio debugging starts but application doesn't

So, the problem that I am having is that when I push F5, or click Start, Visual Studio starts debugging, but the application doesn't actually build. If I go to my Task Manager, and look for the process it isn't there. Or, if I alt-tab between the programs I had open. I have had this problem twice now. The last projet I started, I encountered this problem. I spent days looking for answers on my time off but couldn't find anyhting. So i started a new project. And now I'm getting the same thing. If I go to my source tree and go back to a previous build and discard my changes, it works fine. But the problem comes back. Its not my coding. I am not getting any build errors. And I don't have any break points. So i can't hit continue. PLease alos note, that between it working, and not working I have not changed ANY setings in Visual Studio. I will post what I have tried. If I forget anything, please forgive me. I have days and days of history to go through in my browser.
Restarted Computer and VS
Ran VS in Admin
Always Build is selected in Tools -> Options -> Projects and
Solutions -> Build and Run
Make sure project is set to Debug in Solution Configuration and
Build is checked in Configuration Manager.
Make sure Only BUild startup projects and dependencies on run is
unchecked
Clean Solution
Unchecked Enable the Visual Studio hosting process in Project ->
Properties -> Debug tab
Made sure vshost32.exe was not running in the background while
program was not running in the Task Manager.
Deleted contents of bin and obj files in my project folder file and
reset computer.
Tried running the program from the exe in previously mentioned
bin/obj file. (The last one does start the process in Task Manager. But still doesnt show in the task bar, or alt tab.)
None of these have worked. I am getting very frustrated at this. Maybe I am not looking for the right thing in Google...
I suggest you close all third party tools/processes like the Anti-virus or others, and then re-debug it.
Or
You could run your VS in safemode:
devenv /SafeMode
Some community members found that the symbols loaded is really slow recently, and this issue has been report the Microsoft product team, so please also disable the Microsoft symbols server under TOOLS->Options->Debugging->Symbols. Debug it again.

PostgreSQL Error: The program can't start because libpq.dll is missing from your computer

I'm using Visual Studio 2010 to build a program in C that can operate on a PostgreSQL database.
Everything is fine in VS, no compile errors, everything looks good.
When I click to debug and run, the code compiles, but then I get a pop up that says:
The program can't start because libpq.dll is missing from your computer
I've installed PostgreSQL and added the folder containing all the necessary files to my include and linker paths, but to no avail.
I cannot figure out why I am still getting this message?
Any suggestions?
The answer's surprisingly simple.
The issue you're seeing comes from the compiled application not being able to find the PostgreSQL libraries. The libpq.lib is used to compile the application, and it links to the DLL at run-time. You can either add it to your system wide path, or bundle the DLL with your application. (I'd add it on the development machine, and bundle the redistributable for a installer package.)
To include it in your path try:
Right click on "My Computer" and select Properties
Then Click on "Advanced System Settings".
Click the "Environment Variables" button at the bottom of the dialog box.
It will pop up a dialog with a group box labeled "System Variables". Find the one in the list box that has a Variable name of "Path".
Now, add the path of the PostgreSQL library folder to the path with a ";" separator.
Now logout or reboot. It's imperative that you at least log out of Windows and log back in for the Visual Studio debugger to pickup the additional executable module paths (that Path variable). Ideally, rebooting sends the new system path to all applications in the system at boot time.
If the Path variable has "C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem" in it, you would add ";C:\Program Files\PostgreSQL\libraries" to make it look like "C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\PostgreSQL\libraries".
Be aware that your path will be really long in most cases. Just add it to the end.
Good luck!
I have Win10 64 bit and this worked for me.
Get portable version of HeidiSQL and copy libpg.dll from the archive to the HeidiSQL installation folder on your computer.
Works like a charm.

Visual Studio Debugger not breaking when function (in external .net dll) is hit

I followed the steps described here to break when a function defined in an external dll is hit, however its not working for me. Maybe I am missing a setting. How can I get it to work?
Checklist:
- Enable just my code is disabled
- Symbols for external dll (System.Data.Entity.dll) appear to have been loaded (see below)
EDIT: the answer is to compile the code as 32 bit. It worked for me, can't say if it will work for others.
Some notes: There is a useful tool to know about. Its called srctool.exe. It comes with Debugging Tools for Windows and got installed under c:\Program Files\Debugging Tools for Windows (x64)\srcsrv on my machine. You can run it on a pdb file and it will tell you whether file has been source indexed or not. If the pdb file is source-indexed, then there is a link embedded in the pdb file which points to a location from where the source code can be fetched. E.g., I see this output from srctool.exe:
[f:\dd\ndp\fx\src\DataEntity\System\Data\Objects\DataClasses\RelatedEnd.cs] trg: http://referencesource.microsoft.com/source/NET/4.5/net//ndp/fx/src/DataEntity/System/Data/Objects/DataClasses/RelatedEnd.cs/550320/RelatedEnd.cs
What if pdb file is not source indexed? Does it mean VS will not be able to show you the source, step-in etc.? I think so, though I am not an expert. I found this link to be semi-useful.
Anyway, coming back, for me, fetching code from the embedded link in pdb file meant running this command (VS will give you a popup where it will ask you to run the command; if it fails you won't know; only way to know if it succeeded is to run it yourself from a console) which gave an error.
tf.exe view /version:550320 /noprompt “$/[omitted]/[file].cs” /server:http://[omitted] /console > [file.cs]
To get around this limitation, I manually downloaded .net framework source code from http://referencesource.microsoft.com/netframework.aspx. There was a problem here also: the file gets downloaded as .aspx which doesn't do anything. Turns out you have to rename to .msi. Then run the executable. See this link: http://social.msdn.microsoft.com/Forums/en-US/refsourceserver/thread/f17c11c1-72f6-4529-bafe-5a1d79b72bd7
I just can't believe how many issues I ran into.

Error "There is no source code available for the current location."

I added the AjaxControlToolKit's sample DLL file as a reference to my web application. I used Mask text boxes on my pages.
While debugging the application, it first asked me to open MaskedEditExtender.cs file. So I just search it from my physical location and copied it in the Bin folder of the solution. Well ... now it is not asking for opening that file. But while debugging, after the content page, it debugs the master page as expected, but after just finishing debug of the master page, the debugger traverses to the MaskedEditExtender.cs file...
That is not much of an issue. That's fine (I am curious why this happening), but while debugging the MaskedEditExtender.cs file, it pop ups the message
There is no source code available for the current location."
with two buttons, "OK" and "Disassembly". What is this error? Why is it arriving? How do I avoid it?
You're missing the PDB file (program debug database) of the assembly where the exception occurs.
Open the Breakpoints window, locate the breakpoint, and delete it. This helped me...
You have arrive at a section of your program for which the debugger cannot associate a source code file. Either this is some third-party software for which you do not have the source code.
Or you have the source, but the debugger cannot associate the debugged code to that source file, since you are missing the debug symbols file (the PDB file). This file contains the mapping between the lines in the text source files and the memory address assigned by the compiler to your methods and members.
It could help if you would specify what method you are trying to drill down into when you get this message.

Why do I get a "Metafile not found" error when trying to compile a WPF application?

I had to rebuild a project in my application.
I created a new project, created each file, and copied the contents of each file into the new project one at a time making all the necessary changes.
Now when I try to compile the project, it gives me three errors:
The metafile c:\projects\project1\CustomerModule\bin\Debug\CustomerModule.dll could not be found.
Application Definition Element could not be given by the library project file.
The project file has invalid properties.
Clicking any of these does nothing.
What are these errors telling me? What do I need to change to get my application running again?
New info: If I do a "rebuild" on just the project, I only get the second two errors, so these seem to be the original issue, but what is the library project file and what properties are invalid?
I found the answer on this forum question.
Basically the thing I did wrong was copy images from a directory in one module to a directory in another module within the Solution Explorer. Don't do this. Instead, copy them from the Windows Explorer into the Solution Explorer, then everything works fine.
Click add a reference and browse for the dll file you want to use.
You may have to rebuild the dll for it to work.

Resources