View Issue Details

IDProjectCategoryView StatusLast Update
0001304NoesisGUIC# SDKpublic2018-12-01 19:36
Reportergrigoryp Assigned Tojsantos  
PrioritynormalSeverityminor 
Status confirmedResolutionopen 
Product Version2.1.0f1 
Summary0001304: NoesisException on 2nd launch of Android app
Description

I think that happens due to static initialization. On Xamarin.Android AppDomain remains the same (if you don't kill process) and static fields have old values (from previous launch)

This is why its a bad practice to have any static fields in XA apps.

_view = GUI.CreateView((FrameworkElement)GUI.LoadXaml(XamlName)); - this line throws exception

PlatformAny

Activities

jsantos

jsantos

2018-06-01 22:34

manager   ~0005208

With '2nd launch of Android app' you mean a second Noesis initialization within the same process?

grigoryp

grigoryp

2018-06-04 12:27

reporter   ~0005216

Yeah. And on Android it happens kind of implicitly (coz the process isn't killed when u exit the application).

jsantos

jsantos

2018-06-05 20:46

manager   ~0005218

This is weird and also the fact that nobody reported it before. I wonder if there is a way to 'force' killing the process.

jsantos

jsantos

2018-12-01 19:35

manager   ~0005353

Last edited: 2018-12-01 19:35

We have this in the C++ Application Framework:


void android_main(android_app* app)
{
// Store current app environment
NoesisApp::Display::SetPrivateData(app);

const char* argv[] = { "/system/bin/app_process" };
NsMain(1, (char**)argv);

// We need to kill the process because if we don't do that the native dynamic library will
// be reused for the next activity and all our static variables will have garbage
exit(0);

}

I will check we are doing the same in C#. Long term solution, we should stop using statics in Noesis.

Issue History

Date Modified Username Field Change
2018-05-25 10:57 grigoryp New Issue
2018-06-01 22:34 jsantos Note Added: 0005208
2018-06-01 22:34 jsantos Assigned To => jsantos
2018-06-01 22:34 jsantos Status new => feedback
2018-06-04 12:27 grigoryp Note Added: 0005216
2018-06-04 12:27 grigoryp Status feedback => assigned
2018-06-05 20:46 jsantos Note Added: 0005218
2018-06-05 20:46 jsantos Status assigned => feedback
2018-11-01 02:14 jsantos View Status public => private
2018-12-01 19:35 jsantos Note Added: 0005353
2018-12-01 19:35 jsantos Note Edited: 0005353
2018-12-01 19:36 jsantos Status feedback => confirmed
2018-12-01 19:36 jsantos View Status private => public
2018-12-01 19:36 jsantos Platform => Any