2 years ago

#39833

test-img

Scott Smith

WinForms AppCenter Crashes - AppCenter.Start(...) hangs

I have a WinForms based C# (.NET Framework 4.7.2) project that uses Microsoft.AppCenter 4.4.0 (AppCenter.Analytics and AppCenter.Crashes).

When I call AppCenter.Start on Windows 11 (retail), the app hangs and the call never returns:

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);

AppCenter.Start(ourAppSecretGuid, typeof(Analytics), typeof(Crashes));

Interestingly, this doesn't happen in a debug build if I'm attached to the remote debugger. The call returns (seemingly) normally.

I know that the Visual Studio debugger has some impact on how exceptions/crashes are handled in the program under test, and I suspect that is somehow interacting with the AppCenter crash-interception logic... but I still don't know specifically why this is happening or what to do about it.

EDIT

Here's the stack trace:

  mscorlib.dll!System.Threading.SemaphoreSlim.Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)
  Microsoft.AppCenter.dll!Microsoft.AppCenter.Utils.Synchronization.StatefulMutex.GetLock()
  Microsoft.AppCenter.dll!Microsoft.AppCenter.Channel.Channel.SetEnabled(bool enabled)
  Microsoft.AppCenter.dll!Microsoft.AppCenter.AppCenterService.OnChannelGroupReady(Microsoft.AppCenter.Channel.IChannelGroup channelGroup, string appSecret)
  Microsoft.AppCenter.Crashes.dll!Microsoft.AppCenter.Crashes.Crashes.OnChannelGroupReady(Microsoft.AppCenter.Channel.IChannelGroup channelGroup, string appSecret)
  Microsoft.AppCenter.dll!Microsoft.AppCenter.AppCenter.StartService(Microsoft.AppCenter.IAppCenterService service)
  Microsoft.AppCenter.dll!Microsoft.AppCenter.AppCenter.StartInstance(System.Type[] services)
  Microsoft.AppCenter.dll!Microsoft.AppCenter.AppCenter.PlatformStart(string appSecret, System.Type[] services)
> myapp.exe!SpazzTech.App.Program.Main()
  [Native to Managed Transition]
  mscoreei.dll!_CorExeMain()
  mscoree.dll!_CorExeMain_Exported()
  kernel32.dll!BaseThreadInitThunk()
  ntdll.dll!RtlUserThreadStart()

I'm seeing this in Win 11 running in a Virtual Box VM. I'm setting up a physical Win 11 box to test against.

c#

winforms

visual-studio-app-center

0 Answers

Your Answer

Accepted video resources