diff --git a/samples/MonoSanity/wwwroot/index.html b/samples/MonoSanity/wwwroot/index.html
index 003d37c2fa..51feee8def 100644
--- a/samples/MonoSanity/wwwroot/index.html
+++ b/samples/MonoSanity/wwwroot/index.html
@@ -104,6 +104,19 @@
function triggerJsException() {
throw new Error('This is a JavaScript exception.');
}
+
+ // Normally, applications would use the higher-level APIs for registering invocable
+ // functions, and for invoking them with automatic argument/result marshalling.
+ // But since this project is trying to test low-level Mono runtime capabilities,
+ // we implement our own marshalling here.
+ window.__blazorRegisteredFunctions = {
+ evaluateJsExpression: function (dotNetStringExpression) {
+ var result = eval(dotnetStringToJavaScriptString(dotNetStringExpression));
+ return result === null || result === undefined
+ ? result // Pass through null/undefined so we can verify this is handled upstream
+ : javaScriptStringToDotNetString(result.toString());
+ }
+ };