开发者

Visual Studio stops debugging with no errors unexpectedly

开发者 https://www.devze.com 2022-12-28 16:55 出处:网络
I am debugging a project and Visual Studio stops debugging and closes the program on the following line with no exceptions or error messages (I have enabled notifications for any thrown exceptions in

I am debugging a project and Visual Studio stops debugging and closes the program on the following line with no exceptions or error messages (I have enabled notifications for any thrown exceptions in options):

var query = Session.Linq<RSS>()
            .Where(x => x.LastRetrieved <= date || x.LastRetrieved == null)
            .Where(x => x.Moderated);

Where Session.Linq refers to LINQ2NHibernate. Anyway, the question is: what are the possible reasons for such b开发者_Python百科ehavior? Tested both on VS 2010 and 2008 - they behave identically just falling out of debugging.

Update. If I change application type to "Console Application" it behaves normally. Very strange.


I had a similar problem and although this might not be a solution for your case above, I hope it will help someone else out there.

I had to reference a class that was written by someone else that looked like this:

    public class ItemPrice
    {
        public bool sucessIndicator
        {
            get { return sucessIndicator; }
            set { sucessIndicator = value; }
        }

        public string productCode
        {
            get { return productCode; }
            set { productCode = value; }
        }

        public string description
        {
            get { return description; }
            set { description = value; }
        }

        public double price
        {
            get { return price; }
            set { price = value; }
        }
    }

At first glance it looks ok right... until you notice that each property is referencing it self and not a private member.

So:

public string description
        {
            get { return description; }
            set { description = value; }
        }

is referencing it self recursively and causes a stack overflow exception that did not get shown to me in VS even though I had all exceptions enabled. It just stopped debugging with no warning.

The solution was of course to change it more like this:

public string description
        {
            get;
            set;
        }

Hope that helps someone.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号