Forum Visual Studio
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Razor form does not work in release version

AleksKleynAleksKleyn USMember
edited March 2017 in Visual Studio

I developed Xamarin application for Android forum using Visual Studio 2017. The goal of application is to present math definitions and for this purpose I use vebwiew control and RazorView class. I use mathJax script to represent math expression in application. But I put attention that application works properly in debug mode and does not work in release mode.


  • prashantvcprashantvc USXamarin Team Xamurai

    Could you give us more information not is not working? A sample project would be really useful to debug the issue.
    Also, this is more of an issue with Android/Forms not Visual Studio, you may want to post it in relevant forums

  • AleksKleynAleksKleyn USMember

    I tried to upload zip file with project, but zip file is too large. But I can show hear code itself. I created webView (xamarin) project. Class MainActivity.cs has following code
    using System;
    using Android.App;
    using Android.Content;
    using Android.Runtime;
    using Android.Views;
    using Android.Webkit;
    using Android.Widget;
    using Android.OS;
    using WebApp1.Views;
    using WebApp1.Models;

    namespace WebApp1
    [Activity(Label = "WebApp1", MainLauncher = true)]
    public class MainActivity : Activity
    protected override void OnCreate(Bundle bundle)

            // Set our view from the "main" layout resource
            var webView = FindViewById<WebView>(Resource.Id.webView);
            webView.Settings.JavaScriptEnabled = true;
            // Use subclassed WebViewClient to intercept hybrid native calls
            webView.SetWebViewClient(new HybridWebViewClient());
            // Render the view from the type generated from RazorView.cshtml
            var model = new Model1() { Text = "Text \\(a_1^2\\) goes here" };
            var template = new RazorView() { Model = model };
            var page = template.GenerateString();
            // Load the rendered HTML into the view with a base URL 
            // that points to the root of the bundled Assets folder
            webView.LoadDataWithBaseURL("file:///android_asset/", page, "text/html", "UTF-8", null);
        private class HybridWebViewClient : WebViewClient

    Class HybridWebViewClient had procedure which was called from content file when user clicked there button. I removed this code. But maybe I need similar code which application calls when screen is ready. But I am not sure what event it will be. The code for main.axml is simple
    <?xml version="1.0" encoding="utf-8"?>

    And file RazorView.cshtml has following code
    @model WebApp1.Models.Model1

    <script type="text/x-mathjax-config">
        // This line adds numbers to all equations automatically, unless explicitly suppressed.
        MathJax.Hub.Config({ TeX: { equationNumbers: {autoNumber: "all"} } });
        //errorSettings: { message: ["[Math Processing Error]"] };

            <div data-role="content">
                    Module \(A\)
                    is called algebra
                    if we consider bilinear map
                    g:A\times A\rightarrow A
                    Bilinear map
                    is called product and we use notation
                    We call algebra \(A\) commutative when
                    for any \(a\), \(b\in A\).
                    We can identify linear map
                    \[f:A\rightarrow A\nonumber\]
                    of algebra \(A\) and tensor \(p\in A\otimes A\)
                    using equality
                    \[f(x)=p\circ x\nonumber\]
                    if we assume
                    \[(a\otimes b)\circ x=axb\label{a ox b o x}\]
                    If algebra \(A\) is commutative, then
                    we can identify tensor
                    \(a\otimes b\) and product \(ab\)
                    and the equality
                    \eqref{a ox b o x}
                    gets familiar form
                    (a\otimes b)\circ x=abx

    Other files are created by project. If you think that better other forum, I will appreciate your advice. Code works in debug and does not work in release

Sign In or Register to comment.