Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WinUI 0.5: Unexpected C++ exceptions. #4510

Closed
Noemata opened this issue Mar 13, 2021 · 6 comments
Closed

WinUI 0.5: Unexpected C++ exceptions. #4510

Noemata opened this issue Mar 13, 2021 · 6 comments
Labels
product-winui3 WinUI 3 issues team-Rendering Issue for the Rendering team v0.5 Issues introduced in the Project Reunion 0.5 prerelease

Comments

@Noemata
Copy link

Noemata commented Mar 13, 2021

Describe the bug

WinUI 3 - Project Reunion 0.5, is generating C++ exceptions for a C# managed app.

With WinUI 3 Preview 4, I was not seeing any C++ exceptions for the same project that is now migrated over to 0.5.

image

Repo is located here: https://github.com/Noemata/FakePOS

Steps to reproduce the bug

Steps to reproduce the behavior:

  1. Run app.

Expected behavior
I was expecting the same behavior as I was seeing with WinUI 3 Preview 4.

I made the mistake of telling VS to load debug symbols. I think it may have affected my load/execution speed.

After disabling exceptions as shown below:

image

The exceptions are no longer thrown, but I was not seeing this before. Also, execution speed seems to be much slower now. Please advise.

Version Info

NuGet package version:
[WinUI 3 - Project Reunion 0.5 Preview: 0.5.0-prerelease]

Windows app type:

UWP Win32
No Yes
Windows 10 version Saw the problem?
October 2020 Update (19042) Yes
Device form factor Saw the problem?
Desktop Yes
@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Mar 13, 2021
@StephenLPeters
Copy link
Contributor

@Noemata could you provide a callstack as well? :) It could be a manifestation of an issue with MRT where trying to load a resource that doesn't exist returns an error where before it was treated as okay. Tough to say without a callstack. In that case it would be a known issue (although I'm not sure its on github). @alwu-msft FYI

@StephenLPeters StephenLPeters added v0.5 Issues introduced in the Project Reunion 0.5 prerelease product-winui3 WinUI 3 issues and removed needs-triage Issue needs to be triaged by the area owners labels Mar 16, 2021
@Noemata
Copy link
Author

Noemata commented Mar 17, 2021

Here's the entire call stack, right up until the exception (I am curious why you wouldn't use the repo provided):

[External Code]	

Microsoft.UI.Xaml.Controls.dll!winrt::throw_hresult(struct winrt::hresult) Unknown
Microsoft.UI.Xaml.Controls.dll!winrt::impl::consume_Microsoft_UI_Xaml_Media_IAcrylicBrushStatics::BackgroundSourceProperty(void) Unknown
Microsoft.UI.Xaml.Controls.dll!<lambda_0a1437f4f9e4e85de4e92d9eedff3a11>::<lambda_invoker_cdecl>(struct winrt::Windows::Graphics::Display::IDisplayInformationStatics const &) Unknown
Microsoft.UI.Xaml.Controls.dll!winrt::impl::factory_cache_entrywinrt::Windows::Graphics::Display::DisplayInformation,winrt::Windows::Graphics::Display::IDisplayInformationStatics::call<winrt::Windows::Graphics::Display::DisplayInformation (__cdecl*)(winrt::Windows::Graphics::Display::IDisplayInformationStatics const &)>() Unknown
Microsoft.UI.Xaml.Controls.dll!MaterialHelper::GetNoiseBrushImpl() Unknown
Microsoft.UI.Xaml.Controls.dll!MaterialHelper::GetNoiseBrush(void) Unknown
Microsoft.UI.Xaml.Controls.dll!AcrylicBrush::EnsureNoiseBrush(void) Unknown
Microsoft.UI.Xaml.Controls.dll!AcrylicBrush::CreateAcrylicBrush() Unknown
Microsoft.UI.Xaml.Controls.dll!AcrylicBrush::UpdateAcrylicBrush() Unknown
Microsoft.UI.Xaml.Controls.dll!std::_Func_impl_no_alloc<<lambda_5b13b3b6091b667131bdae3712af62d3>,void,winrt::com_ptr const &,bool>::_Do_call() Unknown
Microsoft.UI.Xaml.Controls.dll!std::_Func_class<void,struct winrt::com_ptr const &,bool>::operator()(struct winrt::com_ptr const &,bool) Unknown
Microsoft.UI.Xaml.Controls.dll!event_base<class event<class std::function >,class std::function,class std::function >::operator()<struct winrt::com_ptr,bool>(struct winrt::com_ptr const &,bool const &) Unknown
Microsoft.UI.Xaml.Controls.dll!(void)() Unknown
Microsoft.UI.Xaml.Controls.dll!MaterialHelper::UpdatePolicyStatus() Unknown
Microsoft.UI.Xaml.Controls.dll!std::_Func_impl_no_alloc<<lambda_f38bc1e85e37f8d661e19832411993ab>,void>::_Do_call() Unknown
Microsoft.UI.Xaml.Controls.dll!winrt::impl::delegate<winrt::Windows::Foundation::EventHandlerwinrt::Windows::Foundation::IInspectable,<lambda_f1ce5351e36cddf637b056ff8b430e0c>>::Invoke() Unknown
Microsoft.ui.xaml.dll!DirectUI::CEventSourceBase<DirectUI::IUntypedEventSource,ABI::Windows::Foundation::IEventHandler<IInspectable *>,IInspectable,IInspectable>::Raise() Unknown
Microsoft.ui.xaml.dll!DirectUI::DXamlCore::OnRenderingEvent() Unknown
Microsoft.ui.xaml.dll!DirectUI::DXamlCore::RaiseEvent() Unknown
Microsoft.ui.xaml.dll!CCoreServices::CallPerFrameCallback() Unknown
Microsoft.ui.xaml.dll!CCoreServices::NWDrawTree() Unknown
Microsoft.ui.xaml.dll!CCoreServices::NWDrawMainTree() Unknown
Microsoft.ui.xaml.dll!CWindowRenderTarget::Draw() Unknown
Microsoft.ui.xaml.dll!CXcpBrowserHost::OnTick() Unknown
Microsoft.ui.xaml.dll!CXcpDispatcher::Tick() Unknown
Microsoft.ui.xaml.dll!CXcpDispatcher::OnReentrancyProtectedWindowMessage() Unknown
Microsoft.ui.xaml.dll!CXcpDispatcher::ProcessMessage() Unknown
Microsoft.ui.xaml.dll!CXcpDispatcher::WindowProc() Unknown
Microsoft.ui.xaml.dll!CDeferredInvoke::DispatchQueuedMessage() Unknown
Microsoft.ui.xaml.dll!Microsoft::WRL::Details::DelegateArgTraits<long (__cdecl ABI::Windows::Foundation::ITypedEventHandler_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Microsoft::System::DispatcherQueueTimer *,ABI::Microsoft::System::IDispatcherQueueTimer *>,IInspectable >::)(ABI::Microsoft::System::IDispatcherQueueTimer *,IInspectable *)>::DelegateInvokeHelper<Microsoft::WRL::Implements<Microsoft::WRL::RuntimeClassFlags<2>,ABI::Windows::Foundation::ITypedEventHandler<ABI::Microsoft::System::DispatcherQueueTimer *,IInspectable *>,Microsoft::WRL::FtmBase>,<lambda_fbe4f38be23425399af0724cc79ee2d3> &,1,ABI::Microsoft::System::IDispatcherQueueTimer *,IInspectable *>::Invoke() Unknown
CoreMessagingXP.dll!Microsoft::WRL::Details::DelegateArgTraits<long ( Windows::Foundation::ITypedEventHandler_impl<struct Windows::Foundation::Internal::AggregateType<class Microsoft::System::DispatcherQueueTimer *,struct Microsoft::System::IDispatcherQueueTimer *>,struct IInspectable >::)(struct Microsoft::System::IDispatcherQueueTimer *,struct IInspectable *)>::DelegateInvokeHelper<struct Microsoft::WRL::Implements<struct Microsoft::WRL::RuntimeClassFlags<2>,struct Windows::Foundation::ITypedEventHandler<class Microsoft::System::DispatcherQueueTimer *,struct IInspectable *>,class Microsoft::WRL::FtmBase>,class <lambda_67362a0a5709a7b3d634a36a54ed7d36>,-1,struct Microsoft::System::IDispatcherQueueTimer *,struct IInspectable *>::Invoke(struct Microsoft::System::IDispatcherQueueTimer *,struct IInspectable *) Unknown
CoreMessagingXP.dll!Microsoft::WRL::InvokeTraits<-2>::InvokeDelegates<class <lambda_00d64a5d69eb8cd85a8562b0747f7e4a>,struct Windows::Foundation::ITypedEventHandler<class Microsoft::System::DispatcherQueueTimer *,struct IInspectable *> >(class <lambda_00d64a5d69eb8cd85a8562b0747f7e4a>,class Microsoft::WRL::Details::EventTargetArray *,class Microsoft::WRL::EventSource<struct Windows::Foundation::ITypedEventHandler<class Microsoft::System::DispatcherQueueTimer *,struct IInspectable *>,struct Microsoft::WRL::InvokeModeOptions<-2> > *) Unknown
CoreMessagingXP.dll!Microsoft::System::DispatcherQueueTimer::TimerCallback(void ) Unknown
CoreMessagingXP.dll!CFlat::SehSafe::Execute<<lambda_654db17c35df07198786f0867aa10de6>>() Unknown
CoreMessagingXP.dll!Microsoft::CoreUI::Dispatch::TimeoutHandler::ImportAdapter$(class CFlat::Box$1<struct CFlat::FunctionPointerAndUserData$1<long (
)(void *)> > *) Unknown
CoreMessagingXP.dll!Microsoft::CoreUI::Dispatch::TimeoutManager::Callback_OnDispatch(void) Unknown
CoreMessagingXP.dll!Microsoft::CoreUI::Dispatch::Dispatcher::Callback_DispatchNextItem(void) Unknown
CoreMessagingXP.dll!Microsoft::CoreUI::Dispatch::EventLoop::Callback_RunCoreLoop(enum Microsoft::CoreUI::Dispatch::RunMode) Unknown
CoreMessagingXP.dll!Microsoft::CoreUI::Dispatch::SystemCoreMessaging::Callback_OnGroupDispatch(enum Microsoft::CoreUI::Dispatch::SystemCoreMessaging$GroupPriority,struct CFlat::Ref) Unknown
CoreMessagingXP.dll!Microsoft::CoreUI::Dispatch::SystemCoreMessaging::NoContext_GroupDispatchHandler(enum Microsoft::CoreUI::Dispatch::SystemCoreMessaging$GroupPriority,void *) Unknown
CoreMessagingXP.dll!Microsoft::CoreUI::Dispatch::SystemCoreMessaging::NoContext_NormalPriorityDispatchHandler(void *) Unknown
CoreMessaging.dll!Microsoft__CoreUI__DispatchGroupHandler$CallbackThunk(class System::Delegate *) Unknown
CoreMessaging.dll!Microsoft::CoreUI::DispatchGroupHandler::Invoke() Unknown
CoreMessaging.dll!Microsoft::CoreUI::Dispatch::EventLoop::Callback_RunCoreLoop() Unknown
CoreMessaging.dll!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatch() Unknown
CoreMessaging.dll!Microsoft::CoreUI::Dispatch::UserAdapter_DoWork() Unknown
CoreMessaging.dll!Microsoft::CoreUI::Dispatch::UserAdapter_WindowProc() Unknown
user32.dll!UserCallWinProcCheckWow() Unknown
user32.dll!DispatchClientMessage() Unknown
user32.dll!__fnDWORD�() Unknown
ntdll.dll!KiUserCallbackDispatcherContinue�() Unknown
win32u.dll!NtUserGetMessage�() Unknown
user32.dll!GetMessageW() Unknown
Microsoft.ui.xaml.dll!DirectUI::FrameworkApplication::RunDesktopWindowMessageLoop(void) Unknown
Microsoft.ui.xaml.dll!DirectUI::FrameworkApplication::StartDesktop() Unknown
Microsoft.ui.xaml.dll!DirectUI::FrameworkApplicationFactory::Start() Unknown
[External Code]
[Inline Frame] hostpolicy.dll!coreclr_t::execute_assembly(int) Line 89 C++
hostpolicy.dll!run_app_for_context(const hostpolicy_context_t & context, int argc, const wchar_t * * argv) Line 246 C++
hostpolicy.dll!run_app(const int argc, const wchar_t * * argv) Line 275 C++
hostpolicy.dll!corehost_main(const int argc, const wchar_t * * argv) Line 408 C++
hostfxr.dll!execute_app(const std::wstring & impl_dll_dir, corehost_init_t * init, const int argc, const wchar_t * * argv) Line 146 C++
[Inline Frame] hostfxr.dll!?A0xd51c85dd::read_config_and_execute(const std::wstring &) Line 520 C++
hostfxr.dll!fx_muxer_t::handle_exec_host_command(const std::wstring & host_command, const host_startup_info_t & host_info, const std::wstring & app_candidate, const std::unordered_map<enum known_options,std::vector<std::wstring,std::allocatorstd::wstring>,known_options_hash,std::equal_to,std::allocator<std::pair<enum known_options const ,std::vector<std::wstring,std::allocatorstd::wstring>>>> & opts, int argc, const wchar_t * * argv, int argoff, host_mode_t mode, wchar_t * result_buffer, int buffer_size, int * required_buffer_size) Line 1001 C++
hostfxr.dll!fx_muxer_t::execute(const std::wstring host_command, const int argc, const wchar_t * * argv, const host_startup_info_t & host_info, wchar_t * result_buffer, int buffer_size, int * required_buffer_size) Line 566 C++
hostfxr.dll!hostfxr_main_startupinfo(const int argc, const wchar_t * * argv, const wchar_t * host_path, const wchar_t * dotnet_root, const wchar_t * app_path) Line 50 C++
FakePOS.exe!exe_start(const int argc, const wchar_t * * argv) Line 236 C++
FakePOS.exe!wmain(const int argc, const wchar_t * * argv) Line 302 C++
[External Code]

@Noemata
Copy link
Author

Noemata commented Mar 17, 2021

Note by using this repo: https://github.com/Noemata/FakePOS

You have a direct A/B comparison between the same code in UWP (without WinUI) and WinUI desktop. 99% percent of the code is shared. I was quite impressed with WinUI 3 Preview 4 in terms of overall compatibility and its apparent momentum forward.

Things have regressed in some areas with Reunion-0.5. Ultimately, I expect all but the namespace conditional code to work in this sample!

I suggest you start lowering the bar for WinUI xx, and exceed expectations while you still can.

I've given you Microsoft's own corporate LOB sample, packaged up more correctly as a migrated app. Use it.

@riverar
Copy link
Contributor

riverar commented Mar 18, 2021

This repros on supported downlevel OSes 100%, would consider as a blocker for 3.0 GA.

@codendone codendone added fixed-in-Reunion0.8 fixed-internally This bug has been fixed, and the fix will be shipped in the next version of WinUI 3. team-Rendering Issue for the Rendering team labels Apr 24, 2021
@anawishnoff
Copy link
Contributor

Hi @Noemata, you should see a fix for this bug in the upcoming WinUI 3/Project Reunion 0.8 Preview, which you can expect soon. Thanks for filing this!

@Noemata
Copy link
Author

Noemata commented Apr 28, 2021

@anawishnoff , thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product-winui3 WinUI 3 issues team-Rendering Issue for the Rendering team v0.5 Issues introduced in the Project Reunion 0.5 prerelease
Projects
None yet
Development

No branches or pull requests

6 participants