I have been encountering very unhelpful error messages when working with UWP. I am sure at least one of them inherit from WPF, but most of them appear to be new to me. Here is just a list for the record.
Failed to assign to property ‘Windows.UI.Xaml.ResourceDictionary.Source’ because the type ‘Windows.Foundation.String’ cannot be assigned to the type ‘Windows.Foundation.Uri’.
This error was thrown when a library project and the app project are using different version of the WinUI libraries. One of my projects was using a prerelease version of the package. I agree it’s my fault, but this error really does not help me understand what the root cause is.
System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at Windows.UI.Xaml.FrameworkElement.MeasureOverride(Size availableSize)
This was caused by assigning a ContentTemplate binding to a custom control that does not support such a binding.
Error HRESULT E_FAIL has been returned from a call to a COM component.
The above error was thrown if you mistakenly assign a style in a place that it does not belong. For example, if you want to assign a content control’s style to a listview item.
XamlCompiler error WMC0612: The XAML Binary Format (XBF) generator reported syntax error ‘0x09C4’ : Property Not Found
The above happens when I create a custom listview control and custom listviewItem control item. I thought I was able to assign my own customer ListViewItem control’s style to the CustomList control’s style. Of course it was my fault, but the message did not help.
This strange issue really bugs me a lot. I am not sure if it’s caused by my environment or really a UWP problem. In my machine, when I have a library project and an app project, the app project will pass the url of the image to the library control to display. However, the Assets from the app project can disappear after running a few times. It means when I run the app at some point, there is no image at all.
The asset is included as “Content” and “Do not copy”. The Url is as simple as “assets/image/abc.png”. It works fine most of the time. But it may happen that the image not able to render. To resolve it, I have to uninstall the debugging app and then run it again.
This has nothing to do with the code and how to reference it, but I have no idea what the reason is.