Quantcast
Channel: Visual Studio General Questions forum
Viewing all articles
Browse latest Browse all 21115

Any idea why VS 2013 doesn't capture exception?

$
0
0

I just tried my code on VS 2013, code like below,  I put breakpoint on #1, #2 and #3, then run the code, once it stops at #1, I click "Continue", but the code just returns without any exception, it doesn't got to #4 or #5, I expect to have any error captured by the try/catch but I didn't get it there. I tried to click F10 on #1, but the code just returns, it doesn't go to the next line in most cases, but occasionally it does go to the next line, but quite in the next few lines without any error.

I had no clue about that behavior, so I copied the same code to VS 2010, and found it works very fine, I can step over each line, an found error on #3.

I know VS2013 add debug support for async call etc.  but I assume It should work as before on general code.  any idea?

Thanks

      try
      {
        DataService service = new DataService(context);

        var customer = new Customer();
        //customer.DisplayName = "Adutus";
        customer.Id = "1";
        //List<Customer> customers = service.FindAll(customer,1,10).ToList<Customer>();
        customer = service.FindById(customer);

        var invoice = new Invoice(); //#1
        //Mandatory fields
        invoice.DocNumber = Guid.NewGuid().ToString("N").Substring(0, 10);
        invoice.TxnDate = DateTime.Today.Date;
        invoice.TxnDateSpecified = true;
        invoice.CustomerRef = new ReferenceType()
        {
          Value = customer.Id
        };

        Line invLine = new Line(); //#2

        invLine.Amount = 10000;
        invLine.DetailType = LineDetailTypeEnum.SalesItemLineDetail;
        invLine.Description = "Test Product";

        invoice.Line = new Line[] { invLine };   

        Invoice resutlInvoice = service.Add(invoice) as Invoice; //#3

        var invId = resutlInvoice.Id;

        service.Add(invoice); //#4
      }
      catch (Exception e)
      {
        MessageBox.Show(e.Message); //#5
      }


WYX


Viewing all articles
Browse latest Browse all 21115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>