appcenter-sdk-dotnet icon indicating copy to clipboard operation
appcenter-sdk-dotnet copied to clipboard

WPF Desktop bridge app does not report crashes to the AppCenter

Open marekdovjak opened this issue 1 year ago • 12 comments

Description

We have a WPF application, which is distributed in the MSStore using the Windows Desktop bridge. While the application is tested as pure WPF app, it's properly reporting crashes to the AppCenter. But after packaging the exact same app using the Desktop bridge, crashes are no logner reported.

After enabling the Verbose log level and generating test crash, I can see there are 0 crash reports detected. I also checked the Logs.db file in user's AppData folder, table LogEntry doesn't contain any crash reports. It contains few core/analytics records, which are correctly sent to the AppCenter after running the app.

Repro Steps

  1. Create simple wpf app project with the appcenter sdk
  2. Generate test crash
  3. Verify the crash is reported to the AppCenter
  4. Add Windows Application Packaging project for the wpf app to the solution
  5. Run the Packaging project
  6. Generate test crash
  7. Crash is not reported to the AppCenter

Details

Platform: Win10, WPF, NET 7.0, Desktop Bridge SDK version 5.0.2 OS: Windows 10/11 Visual Studio Version 17.6.0

Workaround

I used the DispatcherUnhandledException += App_DispatcherUnhandledException; and

void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
    Crashes.TrackError(e.Exception);
}

as recommended in this issue https://github.com/microsoft/appcenter-sdk-dotnet/issues/1727, so crashes are reported as errors now.

marekdovjak avatar May 24 '23 10:05 marekdovjak

Hi @marekdovjak , thank you for this report. I believe it is a duplicate of https://github.com/microsoft/appcenter-sdk-dotnet/issues/1727.

We already merged the fix and currently preparing the release. It should be available today or tomorrow. I'm closing it as a duplicate.

DmitriyKirakosyan avatar May 24 '23 11:05 DmitriyKirakosyan

@DmitriyKirakosyan I don't think it's duplicate. For wpf app, everything is working well. We have problems when packaging the wpf app with Windows Desktop Bridge.

After upgrading the AppCenter SDK to 5.0.2, problem still persits

marekdovjak avatar May 27 '23 05:05 marekdovjak

Thank you for testing on new version and confirming the issue persists. We will investigate it.

You mentioned that using DispatcherUnhandledException works well for you as a workaround. In the latest version we added DispatcherUnhandledException event listener for catching exceptions, so I would expect it should resolve your issue...

DmitriyKirakosyan avatar May 29 '23 06:05 DmitriyKirakosyan

Hello, I tried to reproduce your error, but when running a WPF application using Windows Application Packaging, crashes are successfully sent to the AppCenter portal. For further investigation, a small demo application that reproduces your error would be very useful to us.

MikhailSuendukov avatar May 29 '23 11:05 MikhailSuendukov

@MikhailSuendukov I realized that the steps I wrote to reproduce the problem were not complete. You have to use the Target Framework Moniker option. So instead of <TargetFramework>net7.0-windows</TargetFramework> use <TargetFramework>net7.0-windows10.0.17763.0</TargetFramework> or similar.

There's simple demo app in the attachment. With the moniker option, crashes are not reported.

WpfApp1.zip

marekdovjak avatar May 29 '23 13:05 marekdovjak

Thank you very much for your demo app, indeed your bug is reproducible on this app. In that case, I will create a work item on our board and keep you updated on progress.

MikhailSuendukov avatar May 29 '23 14:05 MikhailSuendukov

The fix was released, so I'm closing it.

DmitriyKirakosyan avatar Oct 20 '23 06:10 DmitriyKirakosyan

@DmitriyKirakosyan I did a quick test with the sample app I provided earlier and appcenter 5.0.3 - it still doesn't work with the target WapProjTemplate1 (desktop bridge).

marekdovjak avatar Nov 06 '23 08:11 marekdovjak

Hi, I was able to reproduce the error, apparently the SDK incorrectly determines the type of the wrapped application, so I created a draft pull request to fix the bug.

MikhailSuendukov avatar Nov 07 '23 17:11 MikhailSuendukov

when is the next release with this bug fix planned?

sebaJoSt avatar Feb 18 '24 23:02 sebaJoSt

when is the next release with this bug fix planned?

30797593 avatar Mar 05 '24 03:03 30797593

I am encountering the same issue. The project, packaged as a WPF and uploaded to the Microsoft Store, can collect reports in its pure WPF form, but once packaged with the Desktop Bridge, it no longer can.

30797593 avatar Mar 05 '24 03:03 30797593