XNA - process terminates unexpectedly when debugging

I have a curious problem debugging my XNA project. Whenever I click on a specific breakpoint and start looking at the Locals window, the whole process and debugger end without notifying why. A trigger may enter a field with a red exclamation mark, which says: "The evaluation of the function was interrupted."

I do not use explicit multithreading in my code, so I am fooled by how the process can end (it would seem that it reached the end correctly) when it does not actually start.

Thanks for any help.

+4
source share
2 answers

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

Change this:

get { return Level; } 

For this:

 get { return Level; } 

This is actually a fairly common thing in Visual Studio C #, it is very annoying, the autocomplete function always prefers the accessor name over the member name, even if you are in the accessory itself. I realized that after 5 years, Microsoft has already fixed it.

EDIT: n / m I see you have already come to that conclusion in your own question. I guess I should read everything first, I jumped from a pistol.

+7
source

Ok, I found a solution, so for anyone who may come up with a similar problem on this issue: the debugger freezes when trying to evaluate a property that causes a stack overflow, i.e.

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

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

0
source

Source: https://habr.com/ru/post/1394371/


All Articles