I want to emit just debugger; to javascript from c# script sharp code.
I realize I could write Script.Literal(“debugger”).
I’d rather not use Script.Literal unless absolutely needed.
I’d prefer to write something like Debugger.Break(); in c# with the emitted javascript being just debugger;
Is there some sort of attribute that will let me do this if I create an Imported Library?
I want to emit just debugger; to javascript from c# script sharp code. I
Share
This is quite a hack, but it works. You gotta get creative when what you want to do isn’t officially supported, right?
It’s based on the way Script.Alert works and makes use of the
[ScriptAlias]attribute to include a JavaScript comment. Luckily ScriptAliasAttribute passes along the value provided exactly and doesn’t sanitize it in any way.So, using the above code, you can write
Debugger.Break();in your C# code, and you’ll getdebugger;//();in the JavaScript emitted. A little ugly, but it works.