... Elements or attributes where the prefix portion of the element name are identified as mc:Ignorable will not raise errors when processed by a XAML processor. ...
Please see https://docs.microsoft.com/de-de/dotnet/framework/wpf/advanced/mc-ignorable-attribute for additional information about this attribute.
In short: there is the markup extension d:DesignInstance which is supposed to be design time only. This configured by mc:Ignorable="d".
A valid use case: design time intellisense support for data contexts: https://stackoverflow.com/questions/29399157/how-do-i-specify-datacontext-viewmodel-type-to-get-design-time-binding-checkin
This is a attribute for "wpf". But is works also with xamarin.forms (sometimes https://bugzilla.xamarin.com/show_bug.cgi?id=27295 ?).
It does work if the xaml gets compiled (See last comments of linked bugzilla page).
add the following attributes to to any root component of a xaml file:
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DataContext="{d:DesignInstance x:Object}"
mc:Ignorable="d"
try to execute app
Please see https://docs.microsoft.com/de-de/dotnet/framework/wpf/advanced/mc-ignorable-attribute:
... Elements or attributes where the prefix portion of the element name are identified as mc:Ignorable will not raise errors when processed by a XAML processor. ...
The attribute mc:Ignorable is not honored and the app crashes.
Official documentation: https://docs.microsoft.com/de-de/dotnet/framework/wpf/advanced/mc-ignorable-attribute
any xamarin.forms project with xaml code should do it.
I will prepare a repo tommorrow. It does work sometimes, but not always.
And I removed 'live reload' because I got it working. So the underlying issue could be some where else. Sorry for any confusion.
I can confirm we crash on an ignored MarkupExtension, and we should not
Extended "steps to Reproduce" using https://github.com/xamarin/xamarin-forms-samples
and Live Reload:
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DataContext="{d:DesignInstance x:Object}"
mc:Ignorable="d"
- Recompile and navigate to the subpage
- You will get an "TargetInvocationError"
LiveReload.Init();, it works.I do not know, why I get an TargetInvocationError instead of the actual exception like yesterday (older runtime?).
Nethertheless, the added xaml code should be ignored at runtime.
Without LiveReload everything works as expected.
@Gitii do you know if it used to work in 2.5.x ?
Sadly, Live.Reload only supports >= 3 (just tried).
In the linked old bugzilla thread, they are mentioning 2.4 and there are even comments from 2018.
There are some theories and workarounds mentioned in the thread.
In addition I found another repo (https://github.com/sascha-schwegelbauer/XamFormsSample) for reproducibility. It also uses 2.4 but _without_ Live.Reload.
Any fixes?
I exprerienced the same issue. Are there any news?
I have the same issue
The same issue. Any fixes?
Quick fix:
add
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
to the project with xaml files and recompile
This issue doesn't seem to have had any activity in a long time. We're working on prioritizing issues and resolving them as quickly as we can. To help us get through the list, we would appreciate an update from you to let us know if this is still affecting you on the latest version of Xamarin.Forms, since it's possible that we may have resolved this as part of another related or duplicate issue. If we don't see any new activity on this issue in the next 30 days, we'll evaluate whether this issue should be closed. Thank you!
Since we haven't heard from you in more than 30 days, we hope this issue is no longer affecting you. If it is, please reopen this issue and provide the requested information so that we can look into it further. Thank you!
reopen please
Most helpful comment
reopen please