Im using VS2012 to analyze a large project that I havent seen before. Im trying to figure out what happens when I click a button, but I dont know where the code for the event is. Is there any way I can get VS to tell me what code was recently run? Or perhaps a way to see what event handlers are associated with a UI element?
You can use the Runtime Flow extension (developed by me, 30-day trial) to list all methods executed after you click on a button.
It sounds like you're looking for a code profiling tool. Normally used to profile performance, it will definitely show you each and every routine hit in your codebase during a particular action.
Some of the more popular ones are dotTrace and RedGate's ants. I think the more expensive versions of Visual Studio.NET also have some profiling built in. Depending on if your code is all managed, and what the execution environment is like (Windows, web, etc.) your mileage may vary.
Edit: In my copy of VS.NET 2013 Pro, I just found the profiler under Analyze -> Profiler.
Related
I'm having a really strange problem that I just can't figure out. Things I compile in Visual Studio 2015 (C# projects in WinForms and WPF) will not launch outside of Visual Studio. This includes a project that is completely new and untouched. As in, create a new WPF Application, build in debug and release. Go to containing folders click on EXEs and...nothing.
When I run them I get 3 processes appearing in Task Manager (named the same as my application) than cannot be killed (through task manager or command prompt) and nothing else occurs. Nothing in event viewer that seems to correspond to the app. I've attached an instance of VS 2015 to the process and I get the following message: WpfApplication.exe has triggered a break point. Pressing Break takes me to a screen that tells me no debug information is available and pressing continue has no visible effects (I can occasionally see slight movement in the cpu % but not a lot else). Any attempt to stop debugging will cause visual studio to hang and when I end its process VS closes but its memory is not freed up according to Task Manager. All of these same things occur when building in VS2013 and attempting to run outside of VS. Everything runs just fine when run in debug mode inside Visual Studio but outside of it...not a chance.
I literally have no idea where to proceed from here. I can find no error messages or clues to point me in a direction to look. Is there something I'm missing/doing wrong? What steps can I take from here to find the source of the problem?
I've considered it may be something wrong with my computer but I want to explore the possibilities before I do something drastic like a clean install. If the prevailing opinion lies that way then I'll seek help elsewhere!
tl;dr: launching the exe of a compiled application results in no running application and no obvious error messages, how can I proceed from here?
I'm going to post an answer to this because I found out what was wrong but it probably isn't useful to have it hanging around so I'll just delete the question at some point soon.
The main lesson to remember is that the main purpose of anti virus software is to frustrate you as much as possible and if something weird is happening try turning it off briefly and see what happens. You'll probably find that things are now working correctly.
EDIT: I should restate this in a more serious fashion.
Anti virus can sometimes affect things in unexpected ways and turning it off temporarily can save you a lot of time. Keep it up to date too, mine was a version or so old and was not functioning correctly. I updated it and the deep scan now functions as expected rather than silently failing.
In in development experience, strange thing I am finding having a PC in a Bank and 3 times it has got errors and changed, and now I am finding issues in VS editors, that for example, short cuts like CTRL KU for uncommenting, and commenting multiple lines together doesn't work properly and my fast typing hands using such short cuts find it difficult to perform activities.
Also, I couldn't do "Undo" of code changes which is very very scary as I used to do a lot of code changes and save and run and again I used to successfully undo everything even though its saved. But I am finding these all not happening in this PC/organization for VS.
I tried googling out for any settings to enable for these features, but futile, as I see not much settings on these found. Could someone please help me out?
Under visual studio
GO to the Tools> Options
A window will pop up. Under Environment choose keyboard.
Make sure visual C# 2005 is selected.
For Comment/Uncomment in your xml file. Make Sure following settings are present there
You might have noticed that "Use New shortcut in" is "Global". In your case it might be something else.
Do the same for Edit.commentselection
As the questions says, I want to write code or debug an appication in real-time without setting breakpoints or pausing/restarting the application.
For example, when I write a game, I want to see what is happening when I change the code for the calculation of the light effects or the AI of the enemies immediately, while running the game on my second monitor.
Update:
Ok, it seems that you guys don't understand exactly what I want.
I want Visual Studio to be more like a WYSIWYG editor...make changes or add new code and see instantly what has changed in my application, without the application to pause it's work.
Update:
I saw this feature in this Video with Java in Eclipse (go to 14:30, where he changes the light effects of the game without stopping it.)
Sometimes. Check out the Edit and Continue feature: http://msdn.microsoft.com/en-us/library/bcew296c%28v=vs.80%29.aspx
Based on the comments, it sounds like you either want a dynamic language (a lot of games are scripted with LUA, or check our IronPython or IronRuby) or you want to dynamically load and reload assemblies, which would require something like MAF perhaps. With that, you could build the bits that you are changing as addins, and then unload and reload the addin assemblies when they change. That seems hacky though, and will likely perform poorly compared to a DLR language.
here is all you want to know abt the Edit and continue feature in Visual Studio:
http://msdn.microsoft.com/en-us/library/bcew296c(v=vs.80).aspx
You can edit the code while debugging, but no instruction will be executed during this time.
If you hit F10, the next instruction will be executed. If you hit F5 the normal execution will continue.
Why not create a resource file with the values to apply. Then have a command you can execute in the app that will reread the file. World of Warcraft has a feature like this. /reload ui
Yes, but unless Edit and Continue is enough for your need you need to design and implement the functionality yourself.
if the change is data driven - just reload the data when some file changes.
if change is in code - consider making that portion of the code to be in separate assembly and dynamically load and rewire the assemebly (may require strongly signed assembly to proper version code). Or dynamically compile code into new assembly (to avoid assembly conflicts in the same app domain).
In all cases you need to figure out how to deal with loosing part of previous state that could be in older objects.
I'd like to know if there is a profiling tool that allows capturing a .NET application's run and at the same time capture it's run in a video format.
Afterwards, allowing to scroll through the run stepping through the exact code that was running that moment?
I'm testing a GUI application using automated code, and would like to know exact what code is being executed and compare with what i'm seeing on screen.
Are you aware of such a tool?
Camtasia will do a video screen capture.
Keep in mind a "video" is entirely different than a recording of how code has been executed. In which case, there's nothing that does both.
If you have Visual Studio 2010 Ultimate, it has a feature called IntelliTrace that sounds like it does most of what you want.
There is a free tool called CamStudio which has a proposed feature called 'Record active Window' (but I don't know if it's implemented in the latest stable release). Check that out to see if you can integrate it to your UI automation.
Edit-And-Continue is one of my favorite debugging tools which I have previously used on C# based Winforms and ASP.NET projects. However, I'm running a Silverlight 3.0 application on VS 2008 and whenever I try to make a change (after breaking) it says "Changes are not allowed when debugging Silverlight applications". Also there isn't an "Enable Edit and Continue" option in the project settings.
Does anyone (possibly an insider) know when this feature will be supported by Microsoft???
(I NEED IT!)
I doubt it will ever be a feature, to be honest. EAC has always required you to attach directly to your .exe in order to work. In the case of Silverlight, that .exe is the browser, which is not the .exe you are developing.
If you are looking to edit XAML while running, you might consider a dynamic loading situation where you can refresh the control at runtime. In that case, you can edit XAML while debugging, but I'm afraid you're stuck with the managed code.
EDIT:
One possibility that you might consider (but I haven't tried it) is to write your code against unit tests. Then, there is a tool called TestDriven.net that allows you to debug your tests with EAC (as an advanced feature). From there, you might be able to do some EAC, but you will be doing it via unit tests, not actually in the Silverlight environment.