Describe the bug
Application crashes on exit at base.h loc 2088 with the following exception.
Exception thrown at 0x00007FFA74BC12AA (iertutil.dll) in App3.exe: 0xC0000005: Access violation reading location 0x0000000000000000.
__declspec(noinline) void unconditional_release_ref() noexcept
{
std::exchange(m_ptr, {})->Release(); // <- Here
}
Steps to reproduce the bug
Steps to reproduce the behavior:
<Window
x:Class="App3.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App3"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<MenuBar Name="TestMenuBar">
<MenuBarItem Name="TestMenuItem" Title="Test"/>
</MenuBar>
<Button x:Name="myButton" Click="myButton_Click">Click Me</Button>
</StackPanel>
</Window>
Expected behavior
App closes without exception.
Screenshots
Version Info
NuGet package version:
Windows app type:
| UWP | Win32 |
| :--------------- | :--------------- |
| | Yes |
| Windows 10 version | Saw the problem? |
| :--------------------------------- | :-------------------- |
| Insider Build (xxxxx) | |
| May 2020 Update (19041) | |
| November 2019 Update (18363) | |
| May 2019 Update (18362) | Yes |
| October 2018 Update (17763) | |
| April 2018 Update (17134) | |
| Fall Creators Update (16299) | |
| Creators Update (15063) | |
| Device form factor | Saw the problem? |
| :----------------- | :--------------- |
| Desktop | Yes |
| Xbox | |
| Surface Hub | |
| IoT | |
Additional context
When run in x86 mode the following exception occurs:
Exception thrown at 0x6E0193DA (iertutil.dll) in App3.exe: 0xC0000005: Access violation reading location 0x00000000.
I beleive this is a known issue with the Preview2 release. @MikeHillberg @Austin-Lamb or maybe @stevenbrix can confrim?
@StephenLPeters I'm not sure without more information. Is this re### lated to MenuBar?
@AaronViviano can you share the callstack?
@stevenbrix Sure thing.
iertutil.dll!00007ff8f15512aa() Unknown
Microsoft.UI.Xaml.dll!00007ff8abfa71a2() Unknown
Microsoft.UI.Xaml.dll!00007ff8abfa72b2() Unknown
Microsoft.UI.Xaml.dll!00007ff8abd9fd6d() Unknown
Microsoft.UI.Xaml.dll!00007ff8abc30284() Unknown
Microsoft.UI.Xaml.dll!00007ff8abfa76c8() Unknown
Microsoft.UI.Xaml.dll!00007ff8abf78203() Unknown
Microsoft.UI.Xaml.dll!00007ff8ac19137b() Unknown
Microsoft.UI.Xaml.Controls.dll!00007ff8a479b964() Unknown
Microsoft.UI.Xaml.Controls.dll!00007ff8a47b46f9() Unknown
Microsoft.UI.Xaml.Controls.dll!00007ff8a47b393e() Unknown
Microsoft.UI.Xaml.Controls.dll!00007ff8a47acd8c() Unknown
Microsoft.UI.Xaml.Controls.dll!00007ff8a46f2b91() Unknown
Microsoft.UI.Xaml.dll!00007ff8abb1df6c() Unknown
Microsoft.UI.Xaml.dll!00007ff8abb957cf() Unknown
Microsoft.UI.Xaml.Controls.dll!00007ff8a465dd41() Unknown
Microsoft.UI.Xaml.Controls.dll!00007ff8a46f1735() Unknown
Microsoft.UI.Xaml.Controls.dll!00007ff8a4765d51() Unknown
Microsoft.UI.Xaml.Controls.dll!00007ff8a47ae332() Unknown
Microsoft.UI.Xaml.Controls.dll!00007ff8a47ae4d8() Unknown
Microsoft.UI.Xaml.Controls.dll!00007ff8a4712e45() Unknown
Microsoft.UI.Xaml.dll!00007ff8abb1df6c() Unknown
Microsoft.UI.Xaml.dll!00007ff8abbfc7cd() Unknown
Microsoft.UI.Xaml.dll!00007ff8abbfc734() Unknown
Microsoft.UI.Xaml.dll!00007ff8abbda6e7() Unknown
Microsoft.UI.Xaml.dll!00007ff8abb1df6c() Unknown
Microsoft.UI.Xaml.dll!00007ff8abc11fbe() Unknown
Microsoft.UI.Xaml.dll!00007ff8abc11de4() Unknown
Microsoft.UI.Xaml.dll!00007ff8abbda6e7() Unknown
Microsoft.UI.Xaml.dll!00007ff8abb1df6c() Unknown
Microsoft.UI.Xaml.dll!00007ff8abc126c1() Unknown
Microsoft.UI.Xaml.dll!00007ff8abf1ea1c() Unknown
Microsoft.UI.Xaml.dll!00007ff8abbda6e7() Unknown
Microsoft.UI.Xaml.dll!00007ff8abb1df6c() Unknown
Microsoft.UI.Xaml.dll!00007ff8abb957cf() Unknown
Microsoft.UI.Xaml.Controls.dll!00007ff8a465dd41() Unknown
Microsoft.UI.Xaml.Controls.dll!00007ff8a46f1735() Unknown
Microsoft.UI.Xaml.Controls.dll!00007ff8a47ac6a9() Unknown
Microsoft.UI.Xaml.Controls.dll!00007ff8a47ac6f0() Unknown
Microsoft.UI.Xaml.Controls.dll!00007ff8a46f2b91() Unknown
> App3.exe!winrt::Windows::Foundation::IUnknown::unconditional_release_ref() Line 2088 C++
App3.exe!winrt::Windows::Foundation::IUnknown::release_ref() Line 2082 C++
App3.exe!winrt::Windows::Foundation::IUnknown::~IUnknown() Line 1996 C++
[External Code]
App3.exe!winrt::impl::root_implements<winrt::App3::implementation::MainWindow,winrt::App3::MainWindow,winrt::composing,winrt::Microsoft::UI::Xaml::Markup::IComponentConnector>::NonDelegatingRelease() Line 7058 C++
App3.exe!winrt::impl::root_implements<winrt::App3::implementation::MainWindow,winrt::App3::MainWindow,winrt::composing,winrt::Microsoft::UI::Xaml::Markup::IComponentConnector>::Release() Line 6930 C++
App3.exe!winrt::implements<winrt::App3::implementation::MainWindow,winrt::App3::MainWindow,winrt::composing,winrt::Microsoft::UI::Xaml::Markup::IComponentConnector>::Release() Line 7503 C++
App3.exe!winrt::impl::produce_base<winrt::App3::implementation::MainWindow,winrt::App3::IMainWindow,void>::Release() Line 6599 C++
App3.exe!winrt::Windows::Foundation::IUnknown::unconditional_release_ref() Line 2088 C++
App3.exe!winrt::Windows::Foundation::IUnknown::release_ref() Line 2082 C++
App3.exe!winrt::Windows::Foundation::IUnknown::~IUnknown() Line 1996 C++
[External Code]
App3.exe!winrt::impl::root_implements<winrt::App3::implementation::App,winrt::Microsoft::UI::Xaml::IApplicationOverrides,winrt::composing,winrt::Microsoft::UI::Xaml::Markup::IXamlMetadataProvider>::NonDelegatingRelease() Line 7058 C++
App3.exe!winrt::impl::root_implements<winrt::App3::implementation::App,winrt::Microsoft::UI::Xaml::IApplicationOverrides,winrt::composing,winrt::Microsoft::UI::Xaml::Markup::IXamlMetadataProvider>::Release() Line 6930 C++
App3.exe!winrt::implements<winrt::App3::implementation::App,winrt::Microsoft::UI::Xaml::IApplicationOverrides,winrt::composing,winrt::Microsoft::UI::Xaml::Markup::IXamlMetadataProvider>::Release() Line 7503 C++
App3.exe!winrt::impl::produce_base<winrt::App3::implementation::App,winrt::Microsoft::UI::Xaml::IApplicationOverrides,void>::Release() Line 6599 C++
[External Code]
@AaronViviano are you able to load symbols for Microsoft.ui.xaml.dll?
@stevenbrix Indeed. Here you go:
iertutil.dll!Microsoft::WRL::ActivationFactory<Microsoft::WRL::Implements<Microsoft::WRL::FtmBase,Windows::Foundation::IUriRuntimeClassFactory>,Windows::Foundation::IUriEscapeStatics,Microsoft::WRL::CloakedIid<Windows::Foundation::Marshaling::Internal::IValueUnmarshalByPropertySet>,0>::Release() Unknown
[Inline Frame] Microsoft.UI.Xaml.dll!ctl::ComPtr<ABI::Windows::Foundation::IUriRuntimeClassFactory>::InternalRelease() Line 270 C++
[Inline Frame] Microsoft.UI.Xaml.dll!ctl::ComPtr<ABI::Windows::Foundation::IUriRuntimeClassFactory>::{dtor}() Line 341 C++
Microsoft.UI.Xaml.dll!DirectUI::StaticStore::~StaticStore() C++
Microsoft.UI.Xaml.dll!DirectUI::StaticStore::`scalar deleting destructor'(unsigned int) C++
Microsoft.UI.Xaml.dll!DirectUI::StaticStore::Release() Line 60 C++
Microsoft.UI.Xaml.dll!xref_ptr<DirectUI::StaticStore>::DecrementRefCount() Line 220 C++
[Inline Frame] Microsoft.UI.Xaml.dll!xref_ptr<DirectUI::StaticStore>::{dtor}() Line 64 C++
Microsoft.UI.Xaml.dll!GetEventHelper(ctl::ComPtr<DirectUI::RoutedEvent> * field, KnownEventIndex index, const wchar_t * name, ABI::Microsoft::UI::Xaml::IRoutedEvent * * ppRoutedEvent) Line 166 C++
[Inline Frame] Microsoft.UI.Xaml.dll!DirectUI::StaticStore::GetPointerPressedEvent(ABI::Microsoft::UI::Xaml::IRoutedEvent * *) Line 237 C++
Microsoft.UI.Xaml.dll!DirectUI::UIElementFactory::get_PointerPressedEventImpl(ABI::Microsoft::UI::Xaml::IRoutedEvent * * ppValue) Line 2406 C++
[External Code]
Microsoft.UI.Xaml.dll!DirectUI::TrackerTargetReference::Clear() Line 624 C++
[Inline Frame] Microsoft.UI.Xaml.dll!DirectUI::TrackerPtr<IUnknown>::Clear() Line 267 C++
[Inline Frame] Microsoft.UI.Xaml.dll!ctl::WeakReferenceSourceNoThreadId::RemovePtrValue(DirectUI::TrackerPtr<IUnknown> &) Line 235 C++
[Inline Frame] Microsoft.UI.Xaml.dll!ctl::WeakReferenceSourceNoThreadId::DeleteTrackerHandle(TrackerHandle__ *) Line 1093 C++
Microsoft.UI.Xaml.dll!ctl::interface_forwarder<ITrackerOwner,DirectUI::DependencyObject>::DeleteTrackerHandle(TrackerHandle__ * handle) Line 100 C++
[External Code]
Microsoft.UI.Xaml.dll!DirectUI::TrackerTargetReference::Clear() Line 624 C++
[Inline Frame] Microsoft.UI.Xaml.dll!DirectUI::TrackerPtr<ABI::Windows::Foundation::Collections::IIterable<IInspectable *>>::{dtor}() Line 27 C++
Microsoft.UI.Xaml.dll!DirectUI::ItemCollection::~ItemCollection() Line 36 C++
[External Code]
Microsoft.UI.Xaml.dll!ctl::ComBase::ReleaseImpl() Line 300 C++
Microsoft.UI.Xaml.dll!DirectUI::TrackerTargetReference::Clear() Line 624 C++
[Inline Frame] Microsoft.UI.Xaml.dll!DirectUI::TrackerPtr<ABI::Windows::Foundation::Collections::IObservableVector<IInspectable *>>::{dtor}() Line 27 C++
Microsoft.UI.Xaml.dll!DirectUI::ItemContainerGenerator::~ItemContainerGenerator() Line 68 C++
[External Code]
Microsoft.UI.Xaml.dll!ctl::ComBase::ReleaseImpl() Line 300 C++
Microsoft.UI.Xaml.dll!DirectUI::TrackerTargetReference::Clear() Line 624 C++
[Inline Frame] Microsoft.UI.Xaml.dll!DirectUI::TrackerPtr<ABI::Microsoft::UI::Xaml::Controls::IItemContainerGenerator>::{dtor}() Line 27 C++
Microsoft.UI.Xaml.dll!DirectUI::ItemsControl::~ItemsControl() Line 64 C++
[External Code]
Microsoft.UI.Xaml.dll!ctl::ComBase::ReleaseImpl() Line 300 C++
Microsoft.UI.Xaml.dll!DirectUI::TrackerTargetReference::Clear() Line 624 C++
[Inline Frame] Microsoft.UI.Xaml.dll!DirectUI::TrackerPtr<IUnknown>::Clear() Line 267 C++
[Inline Frame] Microsoft.UI.Xaml.dll!ctl::WeakReferenceSourceNoThreadId::RemovePtrValue(DirectUI::TrackerPtr<IUnknown> &) Line 235 C++
[Inline Frame] Microsoft.UI.Xaml.dll!ctl::WeakReferenceSourceNoThreadId::DeleteTrackerHandle(TrackerHandle__ *) Line 1093 C++
Microsoft.UI.Xaml.dll!ctl::interface_forwarder<ITrackerOwner,DirectUI::DependencyObject>::DeleteTrackerHandle(TrackerHandle__ * handle) Line 100 C++
[External Code]
> App3.exe!winrt::Windows::Foundation::IUnknown::unconditional_release_ref() Line 2088 C++
App3.exe!winrt::Windows::Foundation::IUnknown::release_ref() Line 2082 C++
App3.exe!winrt::Windows::Foundation::IUnknown::~IUnknown() Line 1996 C++
[External Code]
App3.exe!winrt::impl::root_implements<winrt::App3::implementation::MainWindow,winrt::App3::MainWindow,winrt::composing,winrt::Microsoft::UI::Xaml::Markup::IComponentConnector>::NonDelegatingRelease() Line 7058 C++
App3.exe!winrt::impl::root_implements<winrt::App3::implementation::MainWindow,winrt::App3::MainWindow,winrt::composing,winrt::Microsoft::UI::Xaml::Markup::IComponentConnector>::Release() Line 6930 C++
App3.exe!winrt::implements<winrt::App3::implementation::MainWindow,winrt::App3::MainWindow,winrt::composing,winrt::Microsoft::UI::Xaml::Markup::IComponentConnector>::Release() Line 7503 C++
App3.exe!winrt::impl::produce_base<winrt::App3::implementation::MainWindow,winrt::App3::IMainWindow,void>::Release() Line 6599 C++
App3.exe!winrt::Windows::Foundation::IUnknown::unconditional_release_ref() Line 2088 C++
App3.exe!winrt::Windows::Foundation::IUnknown::release_ref() Line 2082 C++
App3.exe!winrt::Windows::Foundation::IUnknown::~IUnknown() Line 1996 C++
[External Code]
App3.exe!winrt::impl::root_implements<winrt::App3::implementation::App,winrt::Microsoft::UI::Xaml::IApplicationOverrides,winrt::composing,winrt::Microsoft::UI::Xaml::Markup::IXamlMetadataProvider>::NonDelegatingRelease() Line 7058 C++
App3.exe!winrt::impl::root_implements<winrt::App3::implementation::App,winrt::Microsoft::UI::Xaml::IApplicationOverrides,winrt::composing,winrt::Microsoft::UI::Xaml::Markup::IXamlMetadataProvider>::Release() Line 6930 C++
App3.exe!winrt::implements<winrt::App3::implementation::App,winrt::Microsoft::UI::Xaml::IApplicationOverrides,winrt::composing,winrt::Microsoft::UI::Xaml::Markup::IXamlMetadataProvider>::Release() Line 7503 C++
App3.exe!winrt::impl::produce_base<winrt::App3::implementation::App,winrt::Microsoft::UI::Xaml::IApplicationOverrides,void>::Release() Line 6599 C++
Microsoft.UI.Xaml.dll!ctl::release_interface<DirectUI::FrameworkApplication>(DirectUI::FrameworkApplication * & pInterface) Line 137 C++
[Inline Frame] Microsoft.UI.Xaml.dll!DirectUI::FrameworkApplication::GlobalDeinit() Line 622 C++
Microsoft.UI.Xaml.dll!DeinitializeDll() Line 167 C++
Microsoft.UI.Xaml.dll!DllMain(HINSTANCE__ * hinstDLL, unsigned int fdwReason, void * __formal) Line 244 C++
[External Code]
Most helpful comment
@stevenbrix Indeed. Here you go: