question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DebugSettings.EnableFrameRateCounter = true in Desktop causes an AccessViolation

See original GitHub issue

Describe the bug Create a new WinUI Desktop application and set the DebugSettings.EnableFrameRateCounter = true in the application constructor or the OnLaunched and an access violation exception will occur when the application is run.

Exception thrown at 0x7A0D38FC (Microsoft.UI.Xaml.dll) in WinUI_InDesktop.exe: 0xC0000005: Access violation reading location 0x00000000.

Steps to reproduce the bug

  1. In the attached solution, run the WinUiDesktop (Package) application. Note that you will be able to safely step over enabling the frame rate counter but the application will crash shortly after.
  2. For comparision, using the same solution, run the BlankAppUWP (Package). Note that the application will not crash and it will show the framerate counter as expected.

Expected behavior If by chance the DebugSettings.EnableFrameRateCounter setting cannot be used with Desktop applications, then a non-fatal exception message should be thrown. If this feature is supported in Desktop applications then it has a bug.

Screenshots

image

Version Info .Net5.0 Preview 6

NuGet package version: <PackageReference Include="Microsoft.WinUI" Version="3.0.0-preview1.200515.3" />

Note that I have been making WinUI work with Preview 6 by adding this additional direct package reference, a trick I learned from Scott Jones. Although I have been able to accomplish quite a bit of Window related work without any crashes, it was worth mentioning.

<PackageReference Include="Microsoft.Windows.CsWinRT" Version="0.1.0-prerelease.200623.5" />

Windows 10 version Saw the problem?
Insider Build (xxxxx)
May 2020 Update (19041) Yes
November 2019 Update (18363)
May 2019 Update (18362)
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 I have attached a solution for easy reproduction of the problem. WinUIDesktop.zip

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
aybecommented, Mar 21, 2022

This is still happening as of today.

1reaction
duncanmacmichaelcommented, May 25, 2023

Fixed in WinAppSDK 1.4-experimental1 on 05/23/23; @bpulliam can you please close this bug?

Read more comments on GitHub >

github_iconTop Results From Across the Web

DebugSettings.EnableFrameRateCounter Property
Gets or sets a value that indicates whether to display frame-rate and per-frame CPU usage info. These display as an overlay of counters...
Read more >
'Access violation' error in WinUI 3 desktop app cannot be ' ...
I have a fairly complex WinUI 3 desktop app (v1.2, .NET 7, x64 in Debug mode) that keeps failing (after a specific sequence...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found