Google search produces very little mention of this error or solutions.
I get "System.InvalidOperationException: Underlying native object was deleted for Handle = 123456789012. Object.Method" where Object.Method is either a camera Node (rotation) or a Text object (text change) method in the Urhosharp app.
This only happens every other time I open the app, and only if I close it using the back button at the bottom right of the phone (Android). So the first time I open it I get no error. When I close it with the back button and open it again, I get the Exception and the program quits on its own. Then, when I open it again for a third time, the error is not there. But close and open a fourth time, the error reappears, and so on.
But if I close the app manually by using the Recent Apps button on the bottom left of the phone and clicking the X of its window or clicking Close All, then I don't get the error the next time. It even works if after I use the back button to quit, I close its window again in the recent apps list even though it's supposed to already be closed. This leads me to assume that even though I close the app with the back button, it is somehow not totally closed or resources are still tied up until I close it manually with the phone's recent app list.
For what it's worth, the error only started appearing after I implemented remote control of the app through TCP/IP and when I control it that way. The TCP/IP is in the Xamarin.Forms portion, external to Urhosharp, although it does invoke Events that call methods in the Urhosharp app, which is how the exception occurs.
Is there some way I can program the app (C# Visual Studio) to clean itself up when quitting, the same way the phone seems to do when I close it manually through the system? I've tried cleaning up the Nodes in the destructor of the Urho app, but the problem seems to be deeper than that.
I am also at a loss as to how the TCP/IP function is the only thing that causes it. Could it have something to do with the fact that the TCP/IP listener is the only Thread() I'm using in this app? I am however, using Urho.InvokeOnMain() in several places.