A very weird bug. I found a workaround.

Please report bugs here. If you are unsure whether something is a bug or an expected behavior, please post it on the "Technical Support" forum instead, and wait for a moderator to handle/move the post.
melmar
Posts: 2
Joined: Sat Sep 26, 2020 11:32 am

A very weird bug. I found a workaround.

Postby melmar » Tue Sep 29, 2020 11:03 am

The problem is happening if a class inheriting from UserControl assignes the following member of another class inheriting from UserControl:

public static bool line12_useCustomDefinedMineral = false;

The following causes a javascript unhandled exception each time it is executed in the browser starting the second time it is executed but no error in the simulator:
Result.line12_useCustomDefinedMineral = (checkBoxUseCustomMineral != null && checkBoxUseCustomMineral.IsChecked.HasValue && checkBoxUseCustomMineral.IsChecked == true);

The following is a workaround, WHICH IS BASICALLY THE SAME CODE, does NOT cause an error in the browser anymore:
if (checkBoxUseCustomMineral != null && checkBoxUseCustomMineral.IsChecked.HasValue && checkBoxUseCustomMineral.IsChecked == true)
Result.line12_useCustomDefinedMineral = true;
else
Result.line12_useCustomDefinedMineral = false;

Exception in google chrome:
Uncaught System_InvalidCastExceptionData: (...)Exception$Data: (...)Exception$HResult: (...)Exception$HelpLink: (...)Exception$IPForWatsonBuckets: (...)Exception$InnerException: (...)Exception$IsTransient: (...)Exception$Message: (...)Exception$RemoteStackTrace: (...)Exception$Source: (...)Exception$StackTrace: (...)Exception$TargetSite: (...)Exception$WatsonBuckets: (...)GetHashCode: (...)GetType: (...)HResult: (...)HelpLink: (...)IPForWatsonBuckets: (...)InnerException: (...)IsTransient: (...)MemberwiseClone: (...)Message: (...)Object_Equals: (...)RemoteStackTrace: (...)Source: (...)StackTrace: (...)TargetSite: (...)ToString: (...)WatsonBuckets: (...)_HResult: 0_className: null_data: null_dynamicMethods: null_exceptionMethod: null_exceptionMethodString: null_helpURL: null_innerException: null_ipForWatsonBuckets: System_UIntPtr {value: 0}_message: "Unable to cast object of type 'System.Int32' to type 'System.Nullable`1[System.Boolean]'."_remoteStackIndex: 0_remoteStackTraceString: null_safeSerializationManager: null_source: null_stackTrace: "Error↵ at captureStackTrace (file:///C:/Users/Melma/source/repos/TotalSoilNutrients/TotalSoilNutrients/bin/Debug/Output/app-cshtml5/libs/JSIL.Bootstrap.js?20209292058:575:15)↵ at System_InvalidCastException._ctor [as _ctor$34=void] (file:///C:/Users/Melma/source/repos/TotalSoilNutrients/TotalSoilNutrients/bin/Debug/Output/app-cshtml5/libs/JSIL.Bootstrap.js?20209292058:592:28)↵ at System_InvalidCastException.System_Exception__ctor [as _ctor] (jsil://closure/System.Exception..ctor:12:25)↵ at System_InvalidCastException._ctor$34=void (file:///C:/Users/Melma/source/repos/TotalSoilNutrients/TotalSoilNutrients/bin/Debug/Output/app-cshtml5/libs/JSIL.Bootstrap.js?20209292058:669:42)↵ at System_InvalidCastException__ctor [as _ctor] (jsil://closure/System.InvalidCastException..ctor:12:25)↵ at new System_InvalidCastException (jsil://closure/System.InvalidCastException:20:21)↵ at throwCastError (file:///C:/Users/Melma/source/repos/TotalSoilNutrients/TotalSoilNutrients/bin/Debug/Output/app-cshtml5/libs/JSIL.Core.js?20209292058:4887:11)↵ at Function.Cast [as $Cast] (file:///C:/Users/Melma/source/repos/TotalSoilNutrients/TotalSoilNutrients/bin/Debug/Output/app-cshtml5/libs/JSIL.Core.js?20209292058:4999:7)↵ at Function.ToggleButton_IsChecked_Changed (file:///C:/Users/Melma/source/repos/TotalSoilNutrients/TotalSoilNutrients/bin/Debug/Output/app-cshtml5/app/CSharpXamlForHtml5.js?20209292058:55943:23)↵ at Windows_UI_Xaml_PropertyMetadata__ctor$30$cm238$eqvoid.Delegate_Invoke [as PropertyMetadata$PropertyChangedCallback$value] (file:///C:/Users/Melma/source/repos/TotalSoilNutrients/TotalSoilNutrients/bin/Debug/Output/app-cshtml5/libs/JSIL.Core.js?20209292058:9346:23)"_stackTraceString: null_watsonBuckets: null_xcode: 0_xptrs: System_IntPtr {value: 0}__proto__: Object

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: A very weird bug. I found a workaround.

Postby JS-Support @Userware » Wed Dec 02, 2020 11:56 pm

Hi

Please be sure to use CSHTML5 v2 instead of v1

Please let me know if it fixes the issue (it should).

Thanks
Regards


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 26 guests

 

 

cron