A File | New Xamarin Forms project with updates applied (as detailed below) causes an exception that breaks execution when CLR Exceptions are enabled
File | New Xamarin Forms project
Update the following in the csproj files:
<PackageReference Include="Xamarin.Forms" Version="4.3.0.947036" />
<PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
Added any element and give it a x:Name. The attached demo project has two buttons added.
Enabled Hot Reload
Run the application (emulator or physical device), modify the MainPage.xaml (such as the button text). Red squiggles appear under the Button elements with a tip indicating the error being reported. The application continues to run. See screen shots provided.
Enable CLR exceptions and repeat step 5.
An exception will be raised as provided in the attached screen shots. The application will continue to run but it interrupts debugging.
Hot Reload should reload the XAML without error.
When modifying a page with hot reload enabled an exception is raised (suppressed when CLR exceptions are not enabled)
Screen shots are included in the attached.
A demo application is attached.
NamescopeError.zip
VS bug #1158393
#
I don't think this is a duplicate of https://github.com/xamarin/Xamarin.Forms/issues/8322
My report is completely different (as far as I can tell)
I was seeing the same issue as well.
Same here. It would be really nice to have this fixed.
Same here. I am no longer using x:Name, I'm using ViewModels instead.
I avoid x:name where possible but sometimes it is just unavoidable
I avoid x:name where possible but sometimes it is just unavoidable
it's not XF bug. This is related to HR
BTW, you can try Non-official hot reload, which should work https://github.com/AndreiMisiukevich/HotReload
Most helpful comment
I was seeing the same issue as well.