NEW!
CSHTML5 has now become OpenSilver!

We are happy to announce that CSHTML5 has been significantly improved and rebranded to 'OpenSilver', which stands for 'Open-source reimplementation of Silverlight'. It is fully backward compatible and it can be downloaded from OpenSilver.net. Upgrading from CSHTML5 to OpenSilver is very easy.
Read the FAQ

Tips for Debugging

 

 

Table of contents

 

Tips for debugging in the Simulator (in C#)

If you are using version 2.x of CSHTML5, please check the options "Suppress JIT optimization on module load (Managed only)" and "Use Managed Compatibility Mode" in the Visual Studio options (menu "Tools" => "Options" => "Debugging" => "General"), as shown in the following screenshot:

 Settings to enable debugging

 

Tips for debugging in the web browser

You can debug in the browser by pressing F12 to open the Developer Tools.

For the best debugging experience, we recommend you to:

  • Check  the option "Pause on caught exceptions":

    Pause on caught exceptions
  • Uncheck the option "Enable JavaScript source maps":

    Chrome Developer Tools settings

    Enable JavaScript source maps

    Unchecking the option allows to debug in JavaScript rather than C#. This improves the accuracy of the debugger and allows you to inspect the variables better.
  • Blackbox "Bridge.js" so that the debugger skips all the code that is in "Bridge.js" (this improves the debugger experience because it removes all the clutter related to the very low-level stuff). To do so, you first need to uncheck "Enable JavaScript source maps" as explained above. Then, open the file "Bridge.js", right-click on the code, and click "Blackbox script", as shown in the following screenshot:

    Blackbox Bridge.js
  • When inspecting a collection in JavaScript, scroll down to the end of the inspector to see the value of the items contained in the collection:

    Inspecting a collection in JavaScript

 

Support

For any question, please post a message on the forums or contact us.