SharpLab icon indicating copy to clipboard operation
SharpLab copied to clipboard

Run C# .NET Framework (x86): try-catch causes SharpLab to become a blank page

Open AndreasLeeb opened this issue 4 months ago • 0 comments

Problem

When the undermentioned code snippet is run, you get a blank page (empty <main> tag). Happens with latest Firefox, Chrome and Edge. The try-catch in the code seems to cause this issue, as it only occurs when I add the try-catch clause.

Steps to reproduce

  • Open a fresh sharplab.io page
  • Set the platform to .NET Framework (x86)
  • Set Results to Run
  • Paste the following source code:
using System;

X.Ev += () => throw new Exception();
X.Run();

public class X {
    public static event Action Ev;
    
    public static void Run() {
        try {
            Ev?.Invoke();
        } catch { }
        Console.WriteLine("Hello");
    }
}

Additional info

JavaScript console logs from Firefox:

11:41:31.747 TypeError: m is undefined Me codemirror.js:897 je codemirror.js:1001 cursorCoords codemirror.js:8389 getJumpCoordinates addon-jump-arrows.ts:235 renderJump addon-jump-arrows.ts:149 replaceJumps addon-jump-arrows.ts:256 addon-jump-arrows.ts:290 yx useRenderExecutionFlow.ts:123 ope useRenderExecutionFlow.ts:155 Sq useRenderExecutionFlow.ts:179 React 10 Pk index.js:4228 c index.js:4524 K6 index.js:2858 k0 index.js:2882 t4 index.js:2925 A0 index.js:5349 I0 resultState.ts:17 f Main.tsx:33 slowUpdateResult StableCodeEditor.tsx:92 BD editor.js:373 qD editor.js:138 open connection.js:76 react-dom.production.min.js:186:199 11:41:31.749 Uncaught TypeError: m is undefined Me codemirror.js:897 je codemirror.js:1001 cursorCoords codemirror.js:8389 getJumpCoordinates addon-jump-arrows.ts:235 renderJump addon-jump-arrows.ts:149 replaceJumps addon-jump-arrows.ts:256 addon-jump-arrows.ts:290 yx useRenderExecutionFlow.ts:123 ope useRenderExecutionFlow.ts:155 Sq useRenderExecutionFlow.ts:179 React 10 Pk index.js:4228 c index.js:4524 K6 index.js:2858 k0 index.js:2882 t4 index.js:2925 A0 index.js:5349 I0 resultState.ts:17 f Main.tsx:33 slowUpdateResult StableCodeEditor.tsx:92 BD editor.js:373 qD editor.js:138 open connection.js:76 codemirror.js:897:44

AndreasLeeb avatar Mar 29 '24 11:03 AndreasLeeb