Skip to content

Mono error in browser console after about 50 clicks #45

Closed

Description

@zbigniew-gajewski

MainPage.xaml:

<Page x:Class="UnoTest.MainPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:local="using:UnoTest"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      mc:Ignorable="d">

    <Grid  Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
        </Grid.RowDefinitions>

        <Grid Grid.Row="0"
              Background="LightBlue">
            <TextBlock x:Name="TextBlock"
                       Margin="20"
                       FontSize="50"
                       VerticalAlignment="Center"
                       HorizontalAlignment="Center"
                       Text="{Binding NumberOfClicks}" />
        </Grid>

        <Button Grid.Row="1"
                FontSize="35"
                Foreground="White"
                Background="Green"
                Content="Click Me !"
                VerticalAlignment="Center"
                HorizontalAlignment="Center"
                Command="{Binding ClickMeButtonCommand}" />
    </Grid>
</Page>

MainPage.xaml.cs:

using UnoTest.Shared.ViewModels;
using Windows.UI.Xaml.Controls;

namespace UnoTest
{
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            InitializeComponent();
            DataContext = new MainPageViewModel();
        }
    }
}

MainPageViewModel.cs:

using System.ComponentModel;
using System.Windows.Input;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;

namespace UnoTest.Shared.ViewModels
{
#if __WASM__
    [Bindable(true)]
#endif
    public class MainPageViewModel : ViewModelBase
    {
        private int numberOfClicks = 0;

        public MainPageViewModel()
        {
            ClickMeButtonCommand = new RelayCommand(() => NumberOfClicks += 1);          
        }

        public ICommand ClickMeButtonCommand { get; } 

        public int NumberOfClicks
        {
            get => numberOfClicks;
            set
            {
                numberOfClicks = value;
                RaisePropertyChanged(nameof(NumberOfClicks));
            }
        }
    }
}

After about 50 clicks, FireFox console shows error:

50clicksmonoerror

MvvmLight compiled to .Net Standard 2.0 has been used.

Activity

  1. jeromelaban commented on Jun 16, 2018

    @jeromelaban
    Member

    The first message is only informative, and has been removed in later builds of the mono-wasm runtime. It only means that the garbage collector is running, and considering the "In use" size, 1.4MB is a good number to have for your sample.

    You can change the runtime version by using the MonoWasmSDKUri, and find a runtime here: https://jenkins.mono-project.com/job/test-mono-mainline-wasm/:

    • Click on a build #
    • Click on Default Configuration
    • Click on azure artifacts
    • Paste the URL in the MonoWasmSDKUri property in your project.

    Those are nighly/alpha builds for testing, but may change the GC behavior.

  2. added a commit that references this issue on Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions