Find StackOverflow generating code in C# using VS2010 - visual-studio-2010

I have solution with few projects for calculation proposes. Code after 20 minutes of work crashing by StackOverflowException. How to find problem? I don't have any recursion functions in code or when i have then by mistake, i don't writing this things.
With what tool i can find some recursions or other things that can produce StackOverFlowException? Or how to find some information that can lead me to solve problem?
Thanks!

Run it in the VS debugger and look at the call stack after the exception occurs.

Related

Getting object reference error in my MVP application

I am receiving random object reference error in different modules of my application.The errors m facing is intermittent. I did debug of my code it looks all correct. Moreover, whenever I run into that error and I try again (immediately after I got error) with same steps with same input conditions that error does not come up. This is something which is happening not only in in development regions but also in production regions. I tried to analyze and I got some leads that there might be problem with temporary ASP. But I don't know how that can cause object reference errors. Sometimes I see Source error information like App_Web_ighjds[some kind of ID I guess]. I don't know where exactly the problem is? As far as my code is concerned It looks all fine. I believe if there was problem with my code then it should be reproducible every time. Does anybody have any idea why such error might be happening? If it is issue with temporary asp.net files then what I should do to avoid such error?? Any help is much appreciated. Thanks.
You're looking for ideas: I would suspect your module initializers or any DI container initialization.
Look for code that runs only on application start.
I would recommend to reset your web server completely before starting new debugging session.
I would also recommend setting Visual Studio debugger to "Break when an exception is thrown", by going to "Exceptions" settings (Ctrl-Alt-E) and checking the "CLR Exception" "Thrown" checkbox.

Visual Studio: How to activate compile errors?

sorry, this is not a very nice question for here, but I'm very stressed right now and i have to finish sth. now, so...
I accidentially deactivated compile errors in Visual Basic and I cannot find the option to reactivate. Google doesn't help, and manuals, too.
Please help :(
Thx very much!
fLo
EDIT:
It's about the errors when, for example, I run the following code:
Dim a As Integer
a = 9999999999999999999
Then, usually, the program gets stopped and a given error message shows (what type of exception, which row etc.).
You're probably looking for View, Error List.

VS2010 Code Analysis, any way to automatically fix certain warnings?

I must say I really like the new code analysis with VS 2010, I have a lot of areas in my code where I am not using CultureInfo.InvariantCultureand code analysis is warming me about this.
I am pretty sure I want to use CultureInfo.InvariantCulturewhere ever code analysis has detected it is missing on Convert.ToString operations.
Is there anyway to get VS to automatically fix warnings of this type?
You cannot do this in VS Code Analysis but CodeIt.Right performs similar analysis (only on source code) and includes auto corrections with every rule. Give it a try!
I don't think you can do that with Visual Studio but Resharper 5 has a Structural Search and Replace functionnality that could work for that.

Unknown build error, 'Exception of type 'System.OutOfMemoryException' was thrown

We have VS.Net solution with 20 projects in it.
Occasionaly, in VS.NET, when we try to build/debug our solution, we get following error:
Unknown build error, 'Exception of type 'System.OutOfMemoryException' was thrown
Only way to "fix" this issue is to reopen Visual Studio and then solution build goes well, but again after some time OutOfMemory exception occur again. It's really annoying to reopen Visual Studio couple times a day, so do you know some workaround for this issue ?
JetBrains is aware of this issue, and they provide some fix for it, using this fix solved my problems for now:
http://www.jetbrains.net/confluence/display/ReSharper/OutOfMemoryException+Fix
Edit:
However, OutOfMemory exception is occuring again, but it's not as often as it is when I dont use this JetBrains fix.
According to what Microsoft recommends, it is not a good idea to have lots of projects within a single solution.
Check out this link http://support.microsoft.com/kb/949755 .
But the solution suggested in the article is not something that be straight away used, because of the code refactoring costs involved.
Have you tried building the solution from outside the IDE. (Something like MSBUILD). That might help.
I have the same Issue if I use ReSharper and run several UnitTests (with enabled CodeCoverage).
I also assume this is a ReSharper problem. And since I disble it while I'm running Unittest the Exception never appears again.
BTW - Disabling it when the exception throws (as mentioned in the comments above) doesn't help, because of disabling it while VS is running will not unload it from memory. The only way to force the unload is to tear down all AppDomains which have loaded the DLL. In a VS Package scenario this means you have to tear down the entire VS process :(
Or you can just minimize Visual Studio for about 10 seconds (see in task manager how the memory usage of devenv.exe drops when minimized). This works for me in most cases.I rarely have to close VS to get rid of this error.
VS reinstallation is temporary solution. Jus increase your machine Virtual memory size. this resolves this issue.
ref below link -
http://windows.microsoft.com/en-in/windows/change-virtual-memory-size#1TC=windows-7

Avoiding Groovy/Grails internals while debugging in IntelliJ Idea

I'm using IntelliJ Idea 8.1.2 for Grails development. The dynamic nature of Groovy is giving me a hard time debugging my code: I keep ending up in the internals of Groovy/Grails, i.e. CachedMethod, ExpandoMetaClass or the like.
Is there a way for example to tell the Idea debugger to completely skip the Groovy/Grails internals while debugging and only make steps in my own code? I did notice that there is a configuration option named "Do not step into specific Groovy classes" in Debugger > Groovy but so far I've noticed no difference.
If not, what is your workaround or how do you cope with the situation? Any help would be greatly appreciated.
File->Settings->Debugger->Stepping
Do not step into the classes...
Yeah, I suffer with this annoyance, too, and I don't have a good solution. My workaround once I'm lost in Groovy/Grails code is just to figure out where I should be back in my code, set a break point there, and hit Continue.

Resources