ME-MarvinE / XCalendar

A plugin for .NET providing an API for representing a calendar along with fully customisable calendar controls for Xamarin Forms and .NET MAUI
MIT License
300 stars 36 forks source link

Android Crash on EventCalendar open in Release Mode #114

Closed Janausch closed 1 year ago

Janausch commented 1 year ago

Describe the bug I am having a strange bug where the App crashes when I open the view with the calendar in it. The behavior only occured when I build the app on Android in release mode. In Debug mode and on windows I didn't had that bug. I don't know what caused this issue but the app worked fine with the last nuget and VS version.

Expected behavior The Calendar shows up like in Debug Mode or on windows.

Steps to reproduce OR link to code That's the tricky part. I tried the build with the sample apps in your repo and couldn't reproduce it. Your sample apps work fine.

Xamarin Forms or .NET MAUI (If related to UI) .Net MAUI with .NET Core 7 in Visual Studio 2022 v17.5.1

Device Info (Optional) Device Model: Pixel 5 Emulator and Nokia X20 Android Version: 13 Windows Version: 19045.2604

Systemlog

03-10 14:12:23.459 pixel5-_api_33 Error 5071 AndroidRuntime android.runtime.JavaProxyThrowable: Microsoft.Maui.Controls.Xaml.XamlParseException: Position 16:14. Type System:Boolean not found in xmlns clr-namespace:System;assembly=mscorlib at Microsoft.Maui.Controls.Xaml.CreateValuesVisitor.Visit(ElementNode node, INode parentNode) at Microsoft.Maui.Controls.Xaml.ElementNode.Accept(IXamlNodeVisitor visitor, INode parentNode) at Microsoft.Maui.Controls.Xaml.ListNode.Accept(IXamlNodeVisitor visitor, INode parentNode) at Microsoft.Maui.Controls.Xaml.ElementNode.Accept(IXamlNodeVisitor visitor, INode parentNode) at Microsoft.Maui.Controls.Xaml.RootNode.Accept(IXamlNodeVisitor visitor, INode parentNode) at Microsoft.Maui.Controls.Xaml.XamlLoader.Visit(RootNode rootnode, HydrationContext visitorContext, Boolean useDesignProperties) at Microsoft.Maui.Controls.Xaml.XamlLoader.Load(Object view, String xaml, Assembly rootAssembly, Boolean useDesignProperties) at Microsoft.Maui.Controls.Xaml.XamlLoader.Load(Object view, String xaml, Boolean useDesignProperties) at Microsoft.Maui.Controls.Xaml.XamlLoader.Load(Object view, Type callingType) at Microsoft.Maui.Controls.Xaml.Extensions.LoadFromXaml[CalendarView](CalendarView view, Type callingType) at XCalendar.Maui.Views.CalendarView.InitializeComponent() at XCalendar.Maui.Views.CalendarView..ctor() at MyAPP.Views.MyKalender.InitializeComponent() at MyAPP.Views.MyKalender..ctor() at MyAPP.Views.MyStartPage.KalenderToolbarItem_Clicked(Object sender, EventArgs e) at System.Threading.Tasks.Task.<>c.b128_0(Object ) at Android.App.SyncContext.<>c__DisplayClass2_0.b0() at Java.Lang.Thread.RunnableImplementor.Run() at Java.Lang.IRunnableInvoker.n_Run(IntPtr , IntPtr ) at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V , IntPtr , IntPtr ) at mono.java.lang.RunnableImplementor.n_run(Native Method) at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:31) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7872) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

Janausch commented 1 year ago

I have found a somewhat similar behavoir here: https://stackoverflow.com/questions/60033916/getting-an-error-trying-to-use-system-namespace-in-xaml

I then changed the CalenderView.xaml and DaysView.xaml to use xmlns:System="clr-namespace:System;assembly=System.Runtime" instead of xmlns:System="clr-namespace:System;assembly=mscorlib"

and it seems to fix the issue.

I am not sure what's the differents between the two assemblies and if it causes any other problems.

ME-MarvinE commented 1 year ago

Will release a new version with the fix (#115) by the end of the week, nice job.