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

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.

Related

Unable to step into 3rd party code using debugger

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

How Can I View/Open This File?

i am trying to open and edit a file that contains some type of custom protection.
file game :gameguard.des
its from lineage2/interlude/system file.
this is not the original version though, it has been modified to block some packets sent to the server.
i've used VS2010 to open it and it shows me the memory and the contents in hex, like viewing computer memory.
here is the file attached. http://www20.zippyshare.com/v/88173717/file.html
so my question is, how can i open it viewing the code in a higher level and edit it? what tools i need to use to do that?
regards, George
This is a Win32 program. You can try to disassemble it, but it's itself a binary file and what the VS2010 is showing you is correct, because it's showing it most probably in HEX format to you.
You need to first figure out which compiler was used to compile this application, then maybe it helps you to refactor the executable.
The fact that you can not directly run this application might be just the extension, maybe if you change the extension to .exe, it runs under windows. I don't recommend it though.

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.

Watch File Contents at Runtime In Netbeans

In My program i open a file and certain changes are being written to the file , so when i debug the program in netbeans (7.1) i want to see the contents at each stage , as i go through the break points
It sounds like you want to see the real time changes to the contents of a file as you step through your program in a debugger. In general the debugger is not great at displaying the contents of a file. The debugger is designed to display the state of the running program and not the state of external items such as the file system.
However you can easily watch the contents of the file through an external editor such as gVim or likely the actual IDE you're using. Most editors will detect the contents of the file changing on disk and prompt you to reload when it changes.

how to know the path,where the errors and warnings are stored in eclipse

My doubt is related to the storage of Error/Warning Messages.
For example I wrote a C program in Eclipse IDE and compiled. The Error/Warning Messages are displayed in the problem tab.
If this is the situation which file in my computer contains the Error/Warning Messages. I need to know the location of this file because I am doing a project related to IDE creation.
Any suggestions or Ideas?
First of all you should know that what you see in Problems view in eclipse has not been saved as a log file in plain text. But if you want to see it:
1- Under each workspace there is a folder named ".metadata" . In linux it is a hide folder and you have to choose show hide files. I am not sure about windows.
2- open this path ".plugins/org.eclipse.core.resources/.projects/" under ".metadata".
3- choose the sub folder with the project name. (The project you want to see prolems for it).
4- there is two files holding the problems named ".markers" and ".markers.snap"
As said this is under Linux. Under windows may be it differs. But it should be something like this.
Not every text editor opens these files. I used emacs!

Resources