Migrating Xamarin.forms app to Android 12 leads to Prism doesn't find the registered viewmodels - xamarin.forms

I have one Xamarin.Forms app with prism 8.1.96 that works great, but when I try to update the Android SDK to have Android 12 (SDK V31), I receive a blank screen and a message that says:
"An error occurred while resolving the page. This is most likely the result of invalid XAML or other type initialization exception."
Since nothing have been changing on XAML side, what can I do to fix this problem?

Without code it's impossible to say what the error is outright. The error message you're referencing can only come from the NavigationException. It's important to look at the inner exception. It likely has a ContainerResolutionException. If you get the Inner Exception and cast it to it's proper type you can call the GetErrors method which would let you get a list back of types/errors... typically the last type/error is the root cause of your issue.
var result = await navigationService.NavigateAsync("SomePath");
if(result.Exception is not null && result.Exception.InnerException is ContainerResolutionException cre)
{
var errors = cre.GetErrors();
var root = errors.Last();
System.Diagnostics.Debugger.Break();
}

Related

Failed to execute 'replaceState' on 'History': #<Object> could not be cloned

I have this Jetstream Laravel application, which has a presence channel set up for chat features.
What's happening is:
When I join the channel and send a message there, everything works fine, except when I try to exit the channel. In every navigation link, the error Uncaught DOMException: Failed to execute 'replaceState' on 'History': #<Object> could not be cloned. is triggered.
Not sure what is causing it...
Curious Fact:
When I join the channel, and leave it, without sending any message, it works as expected. I visit the page that I was supposed to visit, without any error.
You should not change the props who is coming from $page.props.{propName}
Instead if you want to make some changes on a prop like your app {messages}
you should create a new object or array from the prop:
const messages = ref([...page.props.value.messages]);
Now you can change the messages object as many as you want:
messages.push(newMessage)

Calling COM from an ASP.NET 2.0 application works a few times and then times out?

I'm calling a COM object from an ASP.NET application.
Here is the code making the call:
var comType = Type.GetTypeFromProgID(config.ProgramId);
var com = Activator.CreateInstance(comType);
var regionPropertyValue = ReflectionHelpers.GetProperty(com, "Region");
var output = comType.InvokeMember("Execute",
BindingFlags.InvokeMethod,
null, com, new object[] { data });
This call works for a few times and then eventually hang with the following error:
Creating an instance of the COM component with CLSID {xxx} from the IClassFactory failed due to the following error: 8004e024.
I'm not certain where to begin troubleshooting this. I've searched for the error code but am getting a mixed bag of results.
Does the .NET code look correct? Do I need to manually close or dispose of anything making the call?
Update:
Adding the following line to release the object stopped the call from timing out. Previous calls weren't releasing the object which was causing additional calls to hang.
Marshal.FinalReleaseComObject(com);
This hotfix may be of interest to you. Seems like it is probably the same issue you're having.

Exception being thrown from StaticPropertyWatcher.as

Recently, I suddenly began getting the current exception being thrown from a Flex library. The file I was working on (Login.mxml) suddenly began throwing up this exception while loading.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at mx.binding::StaticPropertyWatcher/updateParent()[E:\dev\4.x\frameworks\projects\framework\src\mx\binding\StaticPropertyWatcher.as:150]
at _components_LoginWatcherSetupUtil/setup()
at components::Login()[C:\Users\username\Documents\MP_MAIN\src\components\Login.mxml:0]
<snip ...>
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:700]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1072]
Running it in the debugger doesn't give me a line of my code that is in error, but it does give me a line in StaticPropertyWatcher. Specifically:
override public function updateParent(parent:Object):void
{
// The assumption is that parent is of type, Class, and that
// the class has a static variable or property,
// staticEventDispatcher, of type IEventDispatcher.
parentObj = Class(parent);
if (parentObj["staticEventDispatcher"] != null) /* Exception thrown from here */
{
...
The debugger shows the parentObj is indeed null, explaining the immediate reason for the exception, but I can't seem to determine the deeper cause (i.e. what I did wrong). The updateParent method is being called from the _components_LoginWatcherSetupUtil class, but the debugger says there is no code for that, so the crucial connection between what I wrote and what caused the exception is missing.
So, basically, I can't even debug this. Any ideas for what to do to shed light on what's going wrong?
Your error is being reported as Login.mxml:0
When I see line 0 as the error it tells me that there is a syntax error of some sort. Open string maybe?
I would suggest looking at the file and see if it is set up properly.
Post the full Login.mxml file and let us look at it.
After laboriously adding back every change I made since last committing to my repository, I tracked down the culprit to this problem. Basically, there were several static variables used to keep track of server addresses like this:
public static var MAIN:String = "http://192.168.1.1/";
public static var MANAGE:String = MAIN + "Manage/";
The issue was that I used a non-compile-time constant MAIN to initialize MANAGE. Changing these variables to const fixed the problem.
public static const MAIN:String = "http://192.168.1.1/";
public static const MANAGE:String = MAIN + "Manage/";
Hopefully this will help anyone else coming across this problem

ReferenceError: Error #1065: Variable flash.sensors::Geolocation is not defined

I have a browser application and i want to use the Geolocation class. The problem is that i get that error when i try to use Geolocation.isSupported. I have imported the flash.sensors.Geolocation in the file but still get this error.
Any ideas? Thank you
later edit:
i got that error after i tried something like this:
public static function get isGeolocationSupported():Boolean
{
return Geolocation.isSupported;
}
and called this function.
but if i call directly Geolocation.isSupported i get this error:
VerifyError: Error #1014: Class flash.sensors::Geolocation could not
be found.
This feature is supported only on mobile devices. It is not supported on desktop or AIR for TV devices neither on web applications.
If you are receiving this error when publishing your flash as3 swf it is because you need to declare your class as public. Private classes can not be used as document classes because they are out of the class package and therefore are not a part of the private scope.
The following error is due to not instantiating the Geolocation class
EX: geo = new Geolocation();
ReferenceError: Error #1065: Variable flash.sensors::Geolocation is
not defined
The other error
VerifyError: Error #1014: Class flash.sensors::Geolocation could not
be found.
Is because you did not import the class
I tried:
return (Geolocation != null);
But it gave me the same error - you will need to do a try/catch, unfortunately in this situation.
var result:Boolean = false;
try
{
result = Geolocation.isSupported;
}
catch (e:Error)
{
trace(e.message);
}
finally
{
return result;
}
Maybe my answer come too late, but I was receiving same error yesterday and I could arrange it. You can test the app in Adobe Device Central, where you can change the device you are using. Actually it doesn't work in the default device. I have had also problems when trying to use the app in my smartphone through a swf player, because of the flash version. I had to change it to 10.1 or lower versions (versions supporting Geolocation), and anyway I haven't been able to make it work well, though it was running ok on Device Central.

Flex Error #1009: Cannot access a property or method of a null object reference

I'm getting error while running a game I created with flex.
I know there has been some question about this, but my case is quite weird. I created a simple typing game that is running OK on my computer, but when I tried to deploy it online to facebook, I got those errors. I used code from the tutorial from adobe here http://www.adobe.com/devnet/facebook/articles/flex_fbgraph_pt4.html to deploy my flex game to facebook
This is the error message:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at FacebookUserStatusWeb/init()
at FacebookUserStatusWeb/___FacebookUserStatusWeb_Application1_creationComplete()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()
at mx.core::UIComponent/set initialized()
at mx.managers::LayoutManager/doPhasedInstantiation()
at mx.managers::LayoutManager/doPhasedInstantiationCallback()
And here is snippet of the init() function:
protected var text1:String="Text to be typed"; //hard-coded temporarily
protected const TIMER_INTERVAL:int = 10;
protected var t:Timer = new Timer(TIMER_INTERVAL);
protected var topURL:String=ExternalInterface.call('top.location.toString');
protected function init():void
{
t.addEventListener(TimerEvent.TIMER, updateTimer);
ProblemText.text = new String(text1);
Facebook.init("<my app id>",loginHandler);
currentState = (topURL) ? "loggedout": "loggedoutonfacebook";
}
Some notes:
1.my app id is my facebook app id which I prefer not to show
2.ProblemText is a richtext which I placed the paragraph to be typed by the player.
3.I have deleted the method Application1_creationComplete() but it still appears at the error listing
And also I am curious about the errors other than the first two. What do they mean?
Ah, and if it is helpful, I can post some more of the code
First: You're only seeing one error. Everything you see below the #1009 error is your stack trace, not additional errors.
The stack trace basically tells you the series of things that happened prior to the error occurring, with the most recent at the top. This is useful because often things which happen prior to the actual error you see will contribute to said error.
Second: The null object reference is occurring because something in your init() function tried to access a property in an object that doesn't exist, or an object that doesn't exist. One (slightly messy but effective) way to debug this would be to drop some trace statements in the code to see how far it gets before barfing with the error -- the idea being to isolate the specific line that's causing the problem. Once you've done that, you need to work backwards to figure out why the object or property you're trying to use is null. It could be something simple, like a typo, or it could be more complex. You'll have to sleuth it out, one way or another =)
Good luck!
Finally got the bug. Just in case people have the same case with me, what exactly happened is at my computer I simulated the game with just one state, but when I'm deploying to facebook I have several states (loggedin,loggedout,etc). In the init() I tried to access ProblemText Label that is not present in the current state.

Resources