Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (34 sloc) 2.46 KB

Using the WebAssembly C# Debugger

Currently debugging in WASM is experimentally supported, using Chrome only.

  1. Make your project the startup project (right-click set as startup in Solution Explorer)
  2. Make sure you have the following line in your project file:
    <MonoRuntimeDebuggerEnabled Condition="'$(Configuration)'=='Debug'">true</MonoRuntimeDebuggerEnabled>
    This will ensure that the debugging symbols are generated and loaded by mono
  3. In the debugging toolbar:
  • Select IIS Express as the debugging target
  • Select Chrome as the Web Browser
  • Make sure script debugging is disabled
    iis express settings
  1. Start the debugging session using Ctrl+F5 (F5 will work, but the debugging experience won't be in Visual Studio)
  2. Once your application has started, press Alt+Shift+D (in Chrome, on your application's tab)
  3. A new tab will open with the debugger or instructions to activate it
  4. You will now get the Chrome DevTools to open listing all the .NET loaded assemblies on the Sources tab:
  5. You may need to refresh the original tab if you want to debug the entry point (Main) of your application.

Tips for debugging in Chrome

  • You need to launch a new instance of Chrome with right parameters. If Chrome is your main browser and you don't want to restart it, install another version of Chrome (Chrome Side-by-Side). You may simply install Chrome Beta or Chrome Canary and use them instead.
  • Sometimes, you may have a problem removing a breakpoint from code (it's crashing the debugger). You can remove them in the Breakpoints list instead.
  • Once IIS Express is launched, no need to press Ctrl+F5 again: you simply need to rebuild your Wasm head and refresh it in the browser.
  • To refresh an app, you should use the debugger tab and press the refresh button in the content.
  • If you have multiple monitors, you can detach the debugger tab and put it on another window.
  • For breakpoints to work properly, you should not open the debugger tools (F12) in the app's tab.
  • If you are debugging a library which is publishing SourceLinks, you must disable it or you'll always see the SourceLink code in the debugger. SourceLink should be activated only on Release build.
You can’t perform that action at this time.