In the past, perhaps versions of Visual Studio prior to the 2008 that I am using now, I would do something like this in my VB.NET code:
System.Diagnostics.Debug.WriteLine("Message")
..and the output would go to the output window.
Now it doesn't. Something must first apparently be enabled.
If this involves "attaching a debugger", please explain how to do it. It seems to me that it should just work without too much of a fuss.
Here's a video explaining the issue in real time and showing you all my settings:
http://screencast.com/t/YQnPb0mJcs
I'm using Visual Studio 2008.
Check to see if the "Redirect all Output Window text to the Immediate Window" is checked under Tools -> Options -> Debugging -> General.
Alternatively, you can use the Console.WriteLine() function as well.
Right-click in the output window, and ensure "Program output" is checked.
All good suggestions. I noticed that I don't see this tip mentioned, so I'll say it: In your app.config file, make sure you don't have a <clear/> element in your trace listeners.
You will effectively be clearing the list of trace listeners, including the default trace listener used for Debug statements.
Here's what this would look like in your app.config file:
<system.diagnostics>
<trace>
<listeners>
<!-- This next line is the troublemaker. It looks so innocent -->
<clear/>
</listeners>
</trace>
</system.diagnostics>
If you want to have a placeholder for trace listeners in your app.config file, you should instead use something like this:
<system.diagnostics>
<trace>
<listeners>
</listeners>
</trace>
</system.diagnostics>
Do you definitely have the DEBUG constant defined? Check under project properties -> Compile -> Advanced Compile Options (there's a checkbox for the DEBUG constant. If it isn't checked, your Debug.XXX statements will not be executed).
It should go to the output window if your app is compiled with the Debug configuration rather than the Release configuration. But instead of Debug.WriteLine(), try using Trace.WriteLine() (optionally with a ConsoleTraceListener attached).
Some extra ideas to try or check:
Put a breakpoint before Debug.WriteLine and see what's in System.Diagnostics.Trace.Listeners collection. You should see DefaultTraceListener. If you don't see anything, then no one is listening and that's problem.
Is it possible that the trace listeners being cleared/modified somewhere such as in config file or in the code?
Have you installed any package or add-in to Visual Studio? or using a third-party library?
Can you see debug messages outside of VS? There is a SysInternals application called DebugView that monitors and shows debug output in your system. Run that tool and then run your application. You should see your debug message in DebugView. At least you will know that your application is outputting debug messages but VS does not seem to be listening.
Have you gone through the contents of the output window to see if there is any exception or error being reported. Your debug output is not there but there might be somethings in there that can provide some clues.
Check your Immediate Window. You might have all the output redirected to it.
For me this was the fact that Debug.WriteLine shows in the Immediate window, not the Output. My installation of Visual Studio 2013 by default doesn't even show an option to open the Immediate window, so you have to do the following:
Select Tools → Customize
Commands Tab
View | Other Windows menu bar dropdown
Add Command...
The Immediate option is in the Debug section.
Once you have Ok'd that, you can go to menu View → Other Windows and select the Immediate Window and hey presto all of the debug output can be seen.
Unfortunately for me it also showed about 50 errors that I wasn't aware of in my project... maybe I'll just turn it off again :-)
It happens. I have the similar symptom when I am developing ASP.NET MVC applications on Visual Studio 2010 web developer Express Edition. The execution doesn't break at the breakpoint. There is no output when it executes System.Diagnostic.Debug.Writeline (even though it runs with debug start), and there is nothing wrong with web.config.
My workaround is:
- Goto project properties--> web
- In the Debugger section, check the the ASP.NET option
Hope this helps someone who comes across this thread.
I was having the same problem for an ASP.NET application, and I found out that my Web.Config had the following line:
<system.web>
<trace enabled="false"/>
</system.web>
Just changing it to true, and I started seeing the Debug.WriteLine in Output window.
I had a similar issue with Visual Studio 2013 and MS unit testing. Right clicking on a unit test method and selecting Run Tests any Debug.WriteLine calls would not show up in either the immediate window or the debug output window. Even though the library I was testing and the unit test project itself both had DEBUG conditional checked in the build section of there project properties.
In order for the Debug.WriteLine statements to output anything I needed to run the unit tests by right clicking and selecting Debug Tests. Only then did I get the debug output being written to the debug output window.
I had the same problem in Visual Studio Express 2010. I fresh installed on a debug machine and none of the suggestions worked. I ended up using NLog and logging to a text file as a workaround.
Make sure you press F5 to Start Debugging mode (not Ctr+F5).
F5 Starting Debugging
CTRL+F5 Starting Without Debugging
Related
I am currently working on a project using the Test Explorer in Visual Studio Code and I am having trouble with the context menu.
By default, the context menu displays
If I create a Run profile:
this._runProfile = this._testController.createRunProfile('Run', vscode.TestRunProfileKind.Run, this.runHandler, true);
and click on the command Run Test, then this.runHandler is executed.
However, when I create a Debug profile:
this._debugProfile = this._testController.createRunProfile('Debug', vscode.TestRunProfileKind.Debug, this.debugHandler, true);
the command Debug Test is not showing up in the context menu.
I was expecting to see Debug Test in the context menu and have it execute this.debugHandler every time it is clicked.
Any help would be greatly appreciated. Thank you.
I tried to manually add a command to the package.json and register it with a different handler, but I am unsure if this is the right approach.
I found that it was an issue was in my development environment.
Everything was building, linking, but it only worked once and after that the command Debug Test didn't show up again. I thought it was a bug in the api, but it is not.
After doing everything again, it worked well.
New to working with MuleSoft, and I am getting an error "There are some error in the current classpath" when adding in a Transform Message into the Message Flow. I have just finished setting up Anypoint Studio, so this might be a configuration step I have missed somewhere.
DW Script Error
Payload (default)
I also faced the same issue and i follow below mentioned steps,
Go to the project Right Click > Mule > Update Project Dependencies
Note:- Before performing above steps make sure, you are connected with internet.
Hope it will work for you.
I had the same issue this morning and after a lot of playing around have finally managed to get it working. What did the trick in the end was to go to Project -> Properties -> Java Build Path, click on the Mule Server 3.7.2 EE entry, hit Edit, reselect the same version of the server runtime, click Finish, click Ok. This in itself didn't seem to make any difference, but then I restarted Anypoint Studio and everything was now working correctly.
I have done some digging, and found the following difference in the projects .classpath file:
before:
<classpathentry kind="con" path="MULE_RUNTIME"/>
after:
<classpathentry kind="con" path="MULE_RUNTIME/org.mule.tooling.server.3.7.2.ee"/>
Hopefully this works for you too.
Right click the project --> go to the properties --> select the required java version and any domain projects --> remove any un-referenced java version/domain from Java build path.
Check once if MAVEN_HOME is added as environment variable and %MAVEN_HOME%\bin is added to path variable in environment variables.
Also try deleting the .mule file created in the workspace and then try restarting Anypoint Studio. After that in command prompt traverse till your project folder and run mvn clean install command.
I'm using Visual Studio Professional 2013 and I'm doing some very basic windows forms application.
A month ago, I could do everything I wanted without any problem. But I started some new projects today and for absolutely no reasons, I keep getting this error message when I come to debug or compile:
Debug error BC31019 : Unable to write to output file 'path/form.exe System Error &H80070005&
It can happen simply by changing the size of a textbox or modifying the text content in a label... It's very random... And I can even do an undo (ctrl+z) and then I can debug again, but if I try again to do the thing I did that brought the error message, the same message pops again as I try to run.
After reading a little about the subject, I realized that it was because the .exe file became in read-only mode and when I try to remove it, windows wont let me.
The only thing I can do if I really want to continue, is to restart my computer every times it happens. Then I can continue just like normal as my .exe file is no longer in read-only...
I tried tor run a sfc/scannow in my command prompt to see if i had any problems with my frameworks but everything was fine.
Since, it is when i restart my pc that the bug disapears, isn't anything i can do or run somewhere to do the same thing. I need to find why the exe file goes to read-only for nothing and how to get it back to normal without having to restart my pc every time...
Please help me!
thank you
I came across the same issue and it was related to having a command line argument that VS could not find, then when i clicked stop debugging I ended up in this situation as it seemed VS kept a process running.
I could see this process in task manager but could not end it (it started with the same name as my app)
I found closing VS would release this process.
Restarting VS it would then work ok again.
there may be other ways to reproduce the issue but restarting VS seems to release the file and allow you to continue.
I set the exe properties to Read/write. No effect, but when I set app properties/settings to "Always on top" = False the issue went away and is still away.
Attempting to debug a VB.NET Visual Web Part I am receiving the following error message.
This error happens straight after I press play and and prior to any of the code in my webpart actually executing. I have tried googling and just thinking through what this error might be referring to but can't come up with anything.
I never start debug in SP project not like in a Web one.
Rebuild your webpart project, check that you are configurates as
'Debug'.
Add your process (w3wp.exe) to debug (Ctrl+Alt+P). Or add to your
code where you would like to debug (I think this is same in VB
also):
System.Diagnostics.Debugger.Launch();
I have some idea with error handling in PHP - way to immediately get to place in code where error occurred.
I have written error handler to catch PHP errors, which loads file, that caused an error and displays +/- few lines of code from that file. It also mark line where error occurred and print stack trace, like this:
http://img834.imageshack.us/img834/3754/errh.png
Now, I have an idea, to provide some link (a href=) like other than http protocols (torrent:// or sth), like "netbeans://C:/some/file.php#110" which will put me back into NetBeans editor, open file where error occurred and put cursor in line, which caused a error.
Any ideas how to achieve that goal ?
What you need to do is register a custom url protocol. The techniques depend on the underlying operating system. here's is an example for windows. By opening NetBeans with a system call and the --open [filename] argument, you can open the file in question. However, that way you won't be able to go to a specific line.
In order to do so, you need to use the NetBeans API. If needed, you can use JNBridge to access Java functionality from .NET languages (which you'd need for windows).
All in all, it won't be easy and not cross-platform. A much easier way to go is to use xDebug on the server side and implement the library in the NetBeans editor, which will allow a lot more functionality than what you currently try to accomplish (stack traces, Jumping in Code, Stepping, variable views, ... - just to name a few). There seems to be a started proposal on this for the NetBeans editor.
If you do not care to switch the editor, you can check out Eclipse PHP Development Tools (Eclipse PDT), which has the debugger already implemented. Check out this article on the setup instructions.
I'd use xDebug with Netbean's xdebug integration which already jumps to the errors.
NetBeans IDE already has this option
Please open your project in NetBeans IDE.
main menu -> options -> editor -> hints -> select language php & select all check-boxes.
then refresh project show highlighting errors or undefined variables warnings.
if more with NetBeans IDE
http://netbeans.org/kb/docs/php/editorguide.html