David Miler
David Miler

Reputation: 100

XNA - Process terminates unexpectedly while debugging

I have a curious problem with debugging my XNA project. Whenever I hit a certain breakpoint and start browsing the "Locals" window, the whole process and the debugger terminate without giving any notice as to why. The trigger might be reaching a field with a red exclamation mark that says "Function evaluation was aborted."

I am using no explicit multithreading in my code, therefore I am befuddled how the process can terminate (seemingly as though it correctly reached the end) when it actually doesn't run.

Thanks for any help.

Upvotes: 4

Views: 1281

Answers (2)

David Miler
David Miler

Reputation: 100

Ok, I have found the solution, so, for anyone who might happen upon this question with a similar problem: The debugger hangs when trying to evaluate a property that causes a stack overflow, i.e

protected int level;
    public int Level
    {
        get { return Level; }
    }

as is further explained here http://netpl.blogspot.com/2009_05_01_archive.html

Upvotes: 0

Nic Foster
Nic Foster

Reputation: 2894

This is occurring because your accessor is infinitely recursive, causing a stack overflow.

Change this:

get { return Level; }

To this:

get { return level; }

This is actually a fairly common thing in Visual Studio C#, it's very annoying, the auto-complete feature will always prefer the accessor name over the member name, even when you're within the accessor itself. I figured after 5 years of this Microsoft would've fixed it by now.

EDIT: n/m I see you already came to this conclusion in your own question. I guess I should read the entire thing first, I jumped the gun.

Upvotes: 7

Related Questions