Appcenter-sdk-dotnet: Unable to run application due to error

Created on 22 Jan 2020  路  23Comments  路  Source: microsoft/appcenter-sdk-dotnet

We do not know how to duplicate this but we are now facing an error and cannot run the application.

Description

Crashing when starting the application.

Repro Steps

Please list the steps used to reproduce your issue.

  1. Run application
  2. Error

Details

  1. What is your app platform (Xamarin.Android or Xamarin.iOS or UWP)?

    • e.g. Xamarin.Forms on all 3 platforms (Android, iOS and UWP).

  2. If using Xamarin.Forms or if using portable/shared code to call our SDK APIs, are you using shared project, PCL code or .NET standard code for the application? Which .NET standard version or which PCL profile?

    • WPF .net 4.7.1

  3. Which SDK version are you using?

    • 2.6.2

  4. Which OS version did you experience the issue on?

    • Windows 10

  5. What device version did you see this error on? Were you using an emulator or a physical device?

    • Virtual Machine

  6. What third party libraries are you using?

      -
  7. Please enable verbose logging for your app using AppCenter.LogLevel = LogLevel.Verbose before your call to AppCenter.Start(...) and include the logs here:

Application:
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Xml.XmlException
at System.Xml.XmlTextReaderImpl.Throw(System.Exception)
at System.Xml.XmlTextReaderImpl.ParseText(Int32 ByRef, Int32 ByRef, Int32 ByRef)
at System.Xml.XmlTextReaderImpl.ParseText()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Configuration.XmlUtil.StrictReadToNextElement(System.Configuration.ExceptionAction)
at System.Configuration.BaseConfigurationRecord.ScanSectionsRecursive(System.Configuration.XmlUtil, System.String, Boolean, System.String, System.Configuration.OverrideModeSetting, Boolean)
at System.Configuration.BaseConfigurationRecord.ScanSectionsRecursive(System.Configuration.XmlUtil, System.String, Boolean, System.String, System.Configuration.OverrideModeSetting, Boolean)
at System.Configuration.BaseConfigurationRecord.ScanSections(System.Configuration.XmlUtil)
at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()
Exception Info: System.Configuration.ConfigurationErrorsException
at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean)
at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(System.Configuration.ConfigurationSchemaErrors)
at System.Configuration.Configuration..ctor(System.String, System.Type, System.Object[])
at System.Configuration.ClientConfigurationHost.OpenExeConfiguration(System.Configuration.ConfigurationFileMap, Boolean, System.Configuration.ConfigurationUserLevel, System.String)
at System.Configuration.ConfigurationManager.OpenExeConfigurationImpl(System.Configuration.ConfigurationFileMap, Boolean, System.Configuration.ConfigurationUserLevel, System.String, Boolean)
at Microsoft.AppCenter.Utils.DefaultApplicationSettings.OpenConfiguration()
at Microsoft.AppCenter.Utils.DefaultApplicationSettings..ctor()
at Microsoft.AppCenter.AppCenter..ctor()
at Microsoft.AppCenter.AppCenter.get_Instance()
at Microsoft.AppCenter.AppCenter.PlatformStart(System.String, System.Type[])
at StreetsHeaver.Columbus.Shell.App.OnStartup(System.Windows.StartupEventArgs)
at System.Windows.Application.<.ctor>b__1_0(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Application.RunDispatcher(System.Object)
at System.Windows.Application.RunInternal(System.Windows.Window)
at StreetsHeaver.Columbus.Shell.App.Main()

bug

All 23 comments

What directories does App Center get it's config from?

Hey James, could you check the state of the config file under C:\Users\ (user)\AppData\Local\TestApp\TestApp.exe_(id)\AppCenter.config?
Is there a chance it's being corrupted from outside or perhaps marked as dangerous by antivirus?

@annakocheshkova there are a lot of them and my rough looking through them they all seem fine. We have copied out this directory and cleared from the machine with the problem.

Basically this it gets installed through our automation process for our ui tests. So that is why there is a few. Any limit on how many there can be? Coincidence on the same install id? Or any other reason to error.

It does work fine now and has been for a fair while on about 40 different virtual machines.

Should it maybe be able to delete and re-create the file in this instance rather than always crashing the application?

@james1301 do you mean there are several configs inside TestApp? Are they all named the same?
Or do you mean there are several TestApps? If so, it shouldn't be a problem.
Also, the crash is not coming from the SDK, it's XMLReader that crashes, that's why I assumed that the file is corrupt or something.

No only a single config in each TestApps folder.

But if this file is corrupt it shouldn't crash the application should it?

Yes and apparently it does. Are there any firewall settings maybe on this folder?

Nothing custom for this location no. Wouldn't it fail all of the time in those cases though if these did exist?

It crashed every time it was run, this shouldn't be the case should it? There is the possibility that it could get corrupted from a bug or any other number of operating system/user scenarios. I'm thinking it's unlikely to be a bug in App Center itself, but there definitely an issue to do with it not being able to continue in this state isn't there?

Well yeah if the file was corrupted I guess it would fail 100% time. For one single app, does this happen all of the time or not?

I guess we could add some type of fallback scenario for this, but if a file is corrupted, there's not much we could do - only recreate the config.

No as far as we know this has only happened once so far on our internal infrastructure. But it puts it in a bad state in that you've got to know to clear down some config somewhere.

If any of our end users got in this scenario it would be quite bad. Our software is installed on premises so we do not have any proper control over that. App Center should never result in the application not being able to work should it. Yeah all you could is recreate the config.

A further detail on this is that AppCenter is started and straight away disabled if that were to potentially bring up a problem.

Ok I got the idea, thanks. We'll see what we can do.

Version 3.0.0 will recover config file corruption gracefully.

Hi @guperrot I have just been testing this, is it the expected behaviour that if the config file is corrupt, it takes 2 attempts at running the application for it to run successfully?

From my testing I run the .exe and then nothing happens, but I see the file has been regenerated. Then I have to run again for the application to actually run.

@james1301 it should not take 2 attempts, please attach verbose logs of all the runs.

Hi, @james1301 I was not able to reproduce a situation when the app could start only from the second attempt. What about verbose logs of all runs? Could you please attach them?

Hello @james1301 ,
we haven鈥檛 heard from you in a while and provided information isn鈥檛 enough for the future investigation, so I鈥檓 closing this issue. Please reopen/comment if you have more details or have any other questions.
Thanks

Hi @olmisa sorry I have been slow. Here is a sample project and what I think seems to cause it.

So this is for a WPF application, and it seems to go wrong with the set enabled async to false straight after calling start with analytics and crashes. The order you enter the analytics and crashes in also seems to make the difference, the other way round it doesn't duplicate.

What is worse is that I have realised that this does it on first run of the application at all, for creating the config to begin with. I thought it was just when it was corrupted.

Code:
AppCenter.LogLevel = LogLevel.Verbose;
AppCenter.Start("SECRET", typeof(Analytics), typeof(Crashes));
AppCenter.SetEnabledAsync(false);
base.OnStartup(e);

TestWPF (2).zip

It seems to work if I change it to:

AppCenter.Start("SECRET", typeof(Crashes), typeof(Analytics));

Is that an appropriate workaround?

@guperrot any feedback on the workaround? I have not been able to duplicate it with the workaround I suggested above. But just getting feedback from our datacentre team that they are.

Hey, just letting you know that we've added a fix for this and this is going to be in the next release :)

Thanks @annakocheshkova but is there workaround. I might have to try rolling it back to a prior version. Just this might be a bit messy because it added/updated nugets and the old one seemed to want certain versions.

Or is this going to be out rather soon? Quite urgent for us.

@james1301 this was a deadlock so it's related to timings. You can expect this in the April release.

@james1301 version 3.2.1 which contains a fix was released.

Was this page helpful?
0 / 5 - 0 ratings