CSharpShellApp icon indicating copy to clipboard operation
CSharpShellApp copied to clipboard

Error in CSharpShellCore.Utils.get_Assets() ?

Open Alisis33 opened this issue 1 year ago • 4 comments

The code to access a file in assets folder has not changed, but the Maui version crashes on program start. The text could not be copied, the text below is a OCR and could have errors. I am not sure yet what caused the error exactly.

App crashed 

System.TypelnitializationException: The type initializer for Test.Language'’ threw an exception. 
--> Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot perform runtime binding on a null reference 

at System.Object.CallSite.Target(Closure , CallSite , Object ) 

at System.Dynamic. UpdateDelegates. UpdateAndExecute1 [Object, Object] (CallSite site, Object arg0) 

at CSharpShellCore.Utils.get_Assets() 

at Test.Language.LanguageGet(String defaultLang) 

at Test.Language..cctor() 

End of inner exception stack trace — 

at Test.App..ctor() 

Alisis33 avatar Nov 12 '23 23:11 Alisis33

Most of the methods under CSharpShellCore.Utils abstract away stuff using the current Activity, which will be null before it is opened there. I will make the Assets property work without that, though.

radimitrov avatar Nov 13 '23 18:11 radimitrov

Not work in 3.2.34

Alisis33 avatar Dec 15 '23 01:12 Alisis33

It should work and did so when I tested it last month. Unfortunately it seems like I deleted the test project so I can't reconfirm. At which point in the startup cycle are you trying to access assets? To clarify, you need to update the APK plugin and then rebuild said app.

radimitrov avatar Dec 15 '23 12:12 radimitrov

No, wait. You are using an old pre .NET 7 build of the IDE? I'm not 99% certain the plugin existed then, however updating it wouldn't work since the IDE and it will have different BCL.

radimitrov avatar Dec 15 '23 12:12 radimitrov