debugging with monodevelop from client - c#

I have been used to use visual studio to create web apps and other application. Visual studio makes it possible to place a breake point on a method, and activate that breakpoint from the client side. And as soon as that method gets called, the debugging will begin, and you can press next etc to see the different values of the variables.
Circumstances for the past 6 months, have required me to use monodevelop, since I am working on ubuntu. I am using nginx as webserver. Many times I have searced for documentation on how to debug from monodevelop. I have not been able to find any solution, and mono's documentation hasn't helped me so far, unfortunately. So to debug my code, I write to a log, which is killing me.
Has anyone successfully found a way to debug code using monodevelop, and activate that breakpoint from the client? Similar to the way in visual studio, that I just described?

Yes, you can set breakpoints in Mono the same way you do in VS. Verify you have installed all the relevant packages before.
http://www.mono-project.com/archived/guidedebugger/

Related

Visual studio 2017 professional attach to process not working correcly

I have one solution in VS 2017 pro, where i am unable to attach process and debug properly.
For start, even though my application is loading/running properly, visual studio attach to process screen always shows 0 Sessions against that app-pool/application.
If i then select it, it never hits any of the C# code (weird).
I manage to hit some razor view cshtml files to be debugged, but never the c# code
any ideas?
My first question if you have started process/service. Then build code do you get error message that exe is already in use?
If not then you are not sure about the correct code.
If then aleast run against your code alomst for sure.
If that not solve your problem. We need to see where you have installed and how to service. Also what the code for the service looks like. It help see where you have your first breakpoint in the code.
Usually if it not reaching the breakpoint or the code is grayed out. It is because the binary is not found or it does not match the code. T
The service you are trying to debug are it installed in your building directory so you are sure is lastes version?

Debugging SSIS Script Component - Breakpoint is enabled but it does not hit

I am working on a SSIS package that has some script components (in C#) inside data flow.
I used break points all the time with it and worked fine without any issue.
But yesterday suddenly it stopped working without throwing any errors or any.
The script works fine without breaking or any error, giving me the expected results as well but does not stop on break points.
I didn't change any visual studio configurations or project configuration.
Google and tried all the solutions others provided.
Clear all cache and all debug objects, rebuild the solution again, restart the machine as well but none of those worked.
Does anyone have this kind of experience?
Environment: Windows 10 Pro, VS 2017
Beware that if you're using a newer version of Visual Studio than what the SSIS package was created with, you need to avoid C# syntax that the compiler won't understand. If you don't, your breakpoints won't be hit.
For example, I opened a package created in Visual Studio 2015 with Visual Studio 2017. I used the newer "$" string interpolation instead of string.Format() and that caused the debugger to not hit any break points. Reverting the string interpolation back to string.Format() got the debugger working again.
Had the same issue.
Spent half a day on this, should have checked my notes, because I found this and solved it before, at least for me.
Upgraded to the latest VS2017 and SSDT as of today, no help. Finally created a simple package with just a dataflow that had a csv source, and script transformation component, and a recordset destination. Set a breakpoint in the script component, and it worked.
Compared project properties with my "real" project and found that Configuration Properties | Debugging | InteractiveMode was False; it was True in the test project. Set it to True in the real project, and the breakpoint worked.
I had forgotten that I set it False to test package error handling.
At last found the reason for the issue, the reason is that I used a conditional access operator inside the script.
The compiler compiles the code properly and works fine but the debugger somehow doesn't understand that operator and crashes.
Seems like SSDT use old C# version on debugging..

Debug async code in Xamarin iOS

I seem to be unable to debug any code which uses the async keyword. Does anyone have any idea to solve this? I am completely clueless. I tried different linking settings as suggested by several people, however without success.
Any breakpoint before the use of async works.
EDIT: When I open the solution with Xamarin Studio on a mac, debugging the code works just fine. However I would prefer to develop in Visual Studio.
ANOTHER EDIT: I 'resolved' it by creating all the projects in Xamarin Studio. If I ever find out what the problem was, I will post it here.
You could try to clean the solution and build it again, also delete the app from your device.
It is possible that you could be running unmatched versions of the code.
Restart your machine, after done DO NOT start VS yet
Navigate to C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root
Delete all debugging caches
Do the same for this folder..C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root
Start VS, make sure its running as admin.
Set your breakpoint, verify symbols are loaded and breakpoint holds.

VS 2008 suddenly can't start debugging session

I am having great problems running the application in the debugger from Visual Studio 2008.
When I'm using vshost.exe, it says:
And when vshost.exe is turned of, it simply states:
Interesting thing about it is that when i do use vshost, debugger is actually started and breakpoint is hit on the first line of the Main().
I tried:
rebuilding the project(s)
removing .ncb, .suo, .user for the projects
repairing Visual Studio 2008
changing the build architecture for the project
... no help there...
Any experience in (trouble)shooting that?
More info: some projects DO work, and one that I have to work on, does not.
I have some ideas such as:
trying to create NEW project, add thing by thing to it and see at what point it will start to miss behave
work it other way around, delete project by item by item to see when it will (if it will) be working OK again.
EDIT (for google, as I see that there are many similar questions on the web):
Errors:
Error while trying to run project: Unable to start debugging.
and
Error while trying to run project: Unable to start program '....\PlayKontrol.exe'
Try upgrading your Visual Studio to Service pack 1, if you haven't already.
Did you restarted your computer? You never know how windows will react to that :).
Also be sure there aren't any keys stuck, like the ctrl or windows key.
Note that the key does not have to be visually stuck, it can be stuck for visual studio and not for the explorer.
The most common source of sudden problems like this is corruption of one of the data files that vs uses to cache information between builds.
You've tried a clean build, but this won't delete everything. A real clean build is: quit vs, delete bin, obj, debug, release folders, delete all generated files in the root - primarily ncb. Do the same for any locally built libraries that you're project references.
The easiest way to do this is if you have the code in source control, as you can rename away your entire code folder and then force a get of all the source.
You often need to do all of these things in one hit to clear the problem.
Less frequently, a reinstall of vs will sort things out (although this sounds unlikely in your case if it is only one project that breaks)
Also think carefully about anything you might have installed just prior to it failing... And remember that some install effects may not occur until the next reboot so it could be days ago. A particular cause of this are automatic windows updates and trial versions of things like the vs 11 beta.
You might try running the application from outside of VS, but have a line of code that looks like this: Debugger.Launch(); where you want your first breakpoint.

Debug Class library

I have a c# class library that I am calling from Classic ASP.
Is it possible to debug this using visual studio? Break points in the class don't work, which isn't surprising.
I am running this on iis7 in the browser, rather than through Visual Studio 2010 because of the fact that I'm using a classic ASP page. Do I need to get this running in Visual Studio in order for this to work?
I also tried to use Response.writes, but they result in:
The name 'Response' does not exist in the current context
You need to attach the debugger to the process (either IIS or another debugger that you are using to debug your classic ASP application) that is loading the assembly.
Under VS2010 go to Tools -> Attach to Process (probably the same under 2008 as well).
try to add in the code of the lib: System.Diagnostics.Debugger.Break(); where you want to break. Also ensure the lib is compiled and deployed with the pdb symbols. When the code will reach the instruction, IIS will throw an exception. The system will ask you to attach a debugger, and you're on the way.
I actually wrote an article regarding this:
http://www.jameswiseman.com/blog/tag/visual-studio-2010/
From the article:
Open Visual Studio 2010
This is easy enough if you have it installed. Might be a bit tricky if you don’t ;-)
Open your website in Visual Studio
Again, easy enough.
Fire up your web site.
I.e. open your browser and navigate to the website.
In Visual Studio, click ‘Debug’ Menu -> ‘Attach to process’
You may need to tick the box labelled ‘Show processes from all users’
‘Inetinfo.exe‘ if application protection is low or ”dllhost.exe‘ if application protection is higher. You may get an ‘Attach Security Warning’ popup. If so, continue On. It’s a bit scary at first, but if it’s your own app on your own PC, then you’ll be ok.
If you’re worried about this, follow the advice on MSDN.
Add a breakpoint to your code, and navigate to a location where you will hit it.
Troubleshooting - Registering pdm.dll
This worked on the first occasion that I tried it. Subsequent attempts were not so successful, and I found a few things that I had to do.
When trying to attach to ‘Script Code’ I got the following warning in the IDE.
Warning: Cannot debug script code. The
correct version of pdm.dll is not
registered. Repair your Visual Studio
2010 installation, or run
‘regsvr32.exe
“%CommonProgramFiles%\Microsoft
Shared\VS7Debug\pdm.dll”‘.
Just follow these instructions.
Troubleshooting - Restart IIS
This also helped on one occasion. Can’t really say why.
You will make your life much easier all round if you wrap you .net classes in a web service then call the web service from the classic asp pages.
For debugging, attach the debugger to the process as described in other answers.
For tracing, I find very handy the combination between System.Diagnostics.Trace.Writeline() in the class library and an OutputDebugString listener like DebugView.

Categories

Resources