Xamarin 5 UWP - Issue with DisplayAlert - xamarin

Me and my team have just migrated our cross-platform XF 4 project to XF5.
The only issue that we have encountered thus far is the following:
Our UWP App was throwing an unhandled App.Xaml exception when navigating to a different page for no apparent reason and after some search, installing the nugget Microsoft.UI.Xaml explicitly fixed that issue, even though that nugget package is supposed to be installed along with XF5 nugget.
But right now a new issue has emerged. When calling the await Application.Current.MainPage.**DisplayAlert**(szTitle, szMessage, btnOk, btnCancel); from the UI thread the alert gets displayed properly but when I click on one of its buttons Ι get an unhandled exception
"No installed components were detected. The property path '(controls:AnimatedIcon.State)' could not be resolved for a Setter." where controls is defined as xmlns:controls="using:Microsoft.UI.Xaml.Controls"
Could you please help me find out what is going wrong?
As far as I know the DisplayAlert() is handled by Xamarin.Forms.

Related

After update to Xamarin.Forms 5, App crashes with Shell error

Finally I decided update my app to new Xamarin.Forms 5 ... but after solving few issue with build and running application it crashes with error:
IsTransient: Exception of type 'System.NotImplementedException' was thrown
Message: No Content found for ShellContent, Title:New Contact, Route D_FAULT_ShellContent16
TargetSite: Xamarin.Forms.IShellContentController.GetOrCreateContent
Have anybody faced with the same issue ?
Seems like the issue happens, because Xamarin.Forms 5 does not allow not set ContentTemplate for FlyoutItem

MVVMCross Problem with adding new ContentPage

Could you tell me what I am doing wrong? I've downloaded and installed extension MVVMCross available on https://www.mvvmcross.com/. I've installed it using Tools/Extensions and Updates in VisualStudio 2017 environment. When I created new MVVMCross Multi-Page Xamarin Forms Application then for two existing pages, all works perfectly.
I next needed to add ContentPage, but I have a problem since my new Xamarin Forms ContentPage is not correct: file *.cs is visible in my solution but *.xaml is hidden.
The version of MVVMCross and MVVMCross.binding (core, forms, platform) are 5.2.1 and Xamarin.Forms is 2.3.4.270 and Xamarin.Essentials is 1.5.2.
Could anyone explain to me why I can't add a new page? Thank you in advance.
All steps attached as screens...
Yes Lucas Zhang - MSFT, you may be right. It looks like a problem with version of Xamarin.Forms or MVVMCross. I'm not sure what more? I had version 15.7.xx of VS2017. After creating new MVVMCross Multi-Page Xamarin.Forms application I have versions: MVVMCross (all libraries) 5.2.1, Xamarin.Forms 2.3.4.270. Then I've not got any errors but I couldn't add new ContentPage.
Below all my steps which I made myself to resolve this problem:
I've installed VS2019 too, but it has not resolved the problem.
I've updated Xamarin.Forms to the latest stable version 4.6.0.726 but I had on both version of VS the same problem after updating:
Error NETSDK1022 Duplicate 'EmbeddedResource' items were included. The .NET SDK includes 'EmbeddedResource' items from your project directory by default.
I've read the article on Stack Overflow about this but I couldn't fix the problem.
But then it was possible to add correct new ContentPage.
In my opinion, the best solution is to update Xamarin.Forms and fix the problem with Duplicate Resource. If you know what to do for this, tell me please.
Finally, I've back to my old version of VS2017 and I've updated it to the latest version 15.9.22. Now, I can create ContentPage and application works but from my point of view doesn't work perfectly. I can add picture to this comment but in my Solution after adding new Page I have two separate files in Page folder: *xaml, *.cs. They don't have connection like other pages (like on the screen below). But it works.
I think if I update Xamarin.Forms and I fix Duplicate Resource problem, It will work perfectly.
I had a lot of problem after updating Xamarin.Forms therefore I've returned and I've installed update of VS2017.
It would be perfect to describe how we can fix similar problems :-)

Adding image to Xaml button breaks Xamarin app, but Visual Studio gives no error message

In Xaml, I'm trying to make an image do something when tapped (I'm testing it on Android). The Image tag of the Button class seems to be exactly what I need, but the following code breaks my application:
<Button Clicked="OnListClicked" Image="chimp.jpg"/>
Even though it works fine when I remove the Image tag. I could probably figure out what's wrong if I had an error message, but all that is shown is:
Your app has entered a break state, but there is no code to show because all threads were executing external code (typically system or framework code).
I've had issues with my Xaml code before, and I would get the same message. I'm confused though...my Xaml isn't external, is it? It's just a Xaml file inside my shared project, like any other file.
Under Exception Settings, I have every single box checked, and I also added XamlCompilation:
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
namespace MyApp
{...
so I'm not sure what else I can do to start getting error messages. And I'm using Image in exactly the syntax described in the documentation, so I'm not sure what could be the issue with my Xaml. Anyone have any thoughts about any of this?
The reason I wasn't getting a specific error message was that I was actually navigating to the page with the errors from another page. When I set the page with errors to my root page, I started getting error messages again.
Apparently, my runtime's memory was running out before it could render the image. I had noticed before that my app was limited to five images: any images after the fifth one simply didn't show up. I've never gotten an error for it, though. Perhaps since this time it was a button, it "needs" to be displayed for normal functioning, and that's why it's throwing an error this time?
Either way, I just removed images until there were only 5, including the button image, and now it displays without issue. I'm not sure if this is expected behavior, though. I don't see why my runtime wouldn't be able to handle more than 5 images.

App designer not working for existing titanium apps - XML parse error

I tried to use app designer with an existing app to see if it could render the views properly. However, when I open an existing view in app designer mode it shows the error
XML Parsing Error
Line : 1
Premature end of file.
I've tried this with a brand new project and it seems to work fine without error. I am also using the latest SDK with my old project (5.4.0).
Another thing I wanted to try was using the "Movies" demo app with the app designer and it didn't have an error but it did show a blank page and only when you turned on "Show Anchors" from the toolbar did it show some outlines of controls but they were not in the correct places.
Hopefully someone has some ideas but it seems to me this only works with brand new projects for some reason.
I've looked in the studio log files too and there's no entry for app designer when I use it and see this error message.
Thanks in advance for any help!

ASP.NET MVC 3: Microsoft JScript runtime error: Object doesn't support property or method 'addEventListener'

Error context:
Visual Studio 2010 Service Pack 1
ASP.NET MVC 3 Application
IE9 with Script Debugging enabled for Internet Explorer
Error conditions:
Execution stops int a JavaScript file called "script block [dynamic]" at the following line
doc.addEventListener("DOMNodeInserted", onDOMNodeInserted, false);
that line of code is nested inside the following if block
if (ver >= 9.0)
{
doc.addEventListener("DOMNodeInserted", onDOMNodeInserted, false);
doc.addEventListener("DOMNodeInsertedIntoDocument", onDOMNodeInsertedIntoDocument, false);
}
This is a very persistent error that started happening after I re-imaged my hard drive and reinstalled VS 2010 SP1 and ASP.NET MVC 3. I did it twice to make sure I did it right.
I am going to take a guess and suggest that this bug is the side affect of an un-handled exception in ASP.NET MVC 3 or a bug in IE9. The error seems to ocurr when a (GET?) action method cannot be found that is specified in the ActionLink HTML helper method such as
#Html.ActionLink("Link Text", "Action")
I believe that IE9 does support addEventListener so the error itself is incorrect. Unless I can get more info this error is beyond my ability to fix its cause. I can prevent it by making sure that my action method is there and that it works. That is a workaround not a fix. Fixing the error would prevent it from being erroneously reported because IE9 does in fact support addEventListener.
An answer has been found to this question. The problem was caused by the Divix browser plugin
Solution: Object doesn't support property or method 'addEventListener'
Thank you to a poster on the asp.net forums for helping to solve this problem. The Divix browser plugin has recently been updated. The update may have fixed this issue. However, it remains disabled on my system. Disabling the Divx plug-in definitely fixed this issue for myself and others. I have reported this bug to Divx support.
I've been getting this error today while working on a VS 2010 project, I was using IE9 for my browser. Turns out it's an erroneous message, I should have been getting a page not found error. I tried disabling Divx as mentioned above, but that didn't help. I then tried using Chrome and it reported my error correctly and I was able to solve my problem.
If you get this error, try a different browser which may point you in the right direction.
I turned off Compatibility Mode (was running on local intranet) and the problem went away.

Resources