Silverlight will not show exceptions

I am working on a project in Silverlight and an exception is thrown somewhere. I am not interested in fixing the exception ... I just want to find it.

Instead of showing up Visual Studio and displaying the line where the exception occurred, instead I get a small window that says "Just In Time" that mentions error 4004, a controlled run-time error. He asks which debugger I want to use to solve the problem. But it provides only one option: a new instance of Visual Studio. If I try to accept his suggestion, the new instance complains that the debugger is already attached.

Why does the VS instance, which has built the program and is already running, not throw an exception and show where it is?

+4
source share
4 answers

This is a weird behavior. The first thing I would like to do is change a few settings

  • Disable only my code
  • Enable inline debugging
  • Break on first eliminated throw

This will help you narrow down the place where the exception occurs.

Disable only my code

  • Tools โ†’ Options
  • Debugger
  • Uncheck "Include only my code"

Enable custom debugging

  • Right click on the project and select properties
  • Go to the Debug tab
  • Check the box next to "Enable unmanaged debugging."

Break on first eliminated throw

  • Debugging โ†’ Exceptions
  • Check "Throws" to exclude Common Language runtime
+4
source

Silverlight has the habit of swallowing exceptions. I call this โ€œsilent failureโ€ and find it very expensive and disappointing. When working with Silverlight, all you can do is throw exceptions, for example. failures.

Have a look here: http://msdn.microsoft.com/en-us/library/cc189070%28v=vs.95%29.aspx

There is also a parameter on the elements so that they visualize binding errors, but I forgot what it is when I no longer work in Silverlight.

0
source

It seems like the problem is the type of debugging. In the project properties, make sure that you enable Silverlight debugging. On your website, right-click, go to properties, and then on the "Web" tab, the "Debuggers" section appears below. Make sure Silverlight is selected.

Sometimes a JS debugger joins the IE process, which means there is a debugger, but it just isn't the debugger you want. I think this may be the cause of this problem.

Hope this helps. Miguel

0
source

click "Debug", select "Exceptions", mark exceptions for the executable file in a common language. I had the same problem and I fixed this problem for me.

0
source

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


All Articles