Appcenter-sdk-dotnet: Error on running same WPF Application twice and enabling App Center

Created on 7 Nov 2019  路  9Comments  路  Source: microsoft/appcenter-sdk-dotnet

Description

Basically we start app center and then disable it as we do not know if the users want it enabled or not until they login. Once they login and we have access to the database and determine they have it turned on we can enable it. If the users run two instances of our application this process results in the error on the second login and enabling of the services.

Repro Steps

Please list the steps used to reproduce your issue.

  1. Build the solution
  2. Use the build directory to run the application exe twice of the included sample Test WPF App.zip
  3. Click Login on Instance 1
  4. Click Login on Instance 2
  5. Error

System.Configuration.ConfigurationErrorsException: The configuration file has been changed by another program. (C:\Users\jamesgbAppData\Local\TestApp\TestApp.exe_Url_04wwjc2zimh0gkfdb3eppgrxhlmxvhq4AppCenter.config)

at System.Configuration.MgmtConfigurationRecord.SaveAs(String filename, ConfigurationSaveMode saveMode, Boolean forceUpdateAll)

at System.Configuration.Configuration.SaveAsImpl(String filename, ConfigurationSaveMode saveMode, Boolean forceSaveAll)

at Microsoft.AppCenter.Utils.DefaultApplicationSettings.SaveValue(String key, String value)

at Microsoft.AppCenter.Utils.DefaultApplicationSettings.SetValue(String key, Object value)

at Microsoft.AppCenter.AppCenter.SetInstanceEnabled(Boolean value)

at Microsoft.AppCenter.AppCenter.PlatformSetEnabledAsync(Boolean enabled)

at Microsoft.AppCenter.AppCenter.SetEnabledAsync(Boolean enabled)

at TestApp.MainWindow.ContentControl_Click(Object sender, RoutedEventArgs e) in C:\Users\jamesgb\Desktop\Test WPF App\TestApp\MainWindow.xaml.cs:line 35

Details

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

    • WPF

  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?
    -N/A
  3. Which SDK version are you using?

    • 2.5.0

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

    • Windows 10 (1903)

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

    • Physical PC

  6. What third party libraries are you using?

    • N/A

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

All 9 comments

@AnastasiaKubova any help would this would be appreciated.

This is a feature that we push users to use, so they can do multiple actions in our application if they have multiple screens. So we may need to pull this out of the build with the current problem.

Hello, @james1301, just noticed that you were not responded here. Sorry about that.
Our team is currently working on your issue,
We'll update you with the latest information in a thread.

@Jamminroot I don't suppose if you know if they'll be an update this week? Our build is finishing at the end of this week. I will need to potentially take it out if not.

Hello @james1301, there won't be an update by the end of this week.

We are currently reviewing this use case to see what we can do. At the least, the team agrees that this shouldn't be crashing on you, but we are also discussing what our support for multiple instances should look like. Sorry about the inconvenience :)

Thanks for getting back to me @michaelsmitha. No workaround to know if there鈥檚 one running or anything and not do it on the second instance?

@james1301 Sorry, there isn't currently a workaround we know of in this case. We have a monthly release schedule and November has already been released, so it'll be at least December before we can make some allowance for multiple instances running. I'm not sure how it will be prioritized, however.

@michaelsmitha I mean any kind of solution to avoid the crash.

Do you think it will be OK to catch this exception and then just accept that the second instance will not be sending to App Center.

The first instance should still be fine shouldn't it?

@james1301 It kind of depends. If App Center crashes in a thread, you may just be catching one thread, but the rest of the 2nd instance will continue to try to do stuff - read and write shared resources. If you can be sure App Center just stops running in the 2nd instance, that could be fine. It can't simply be just disabled in one instance though, things like isEnabled are saved on disk, so the multiple instances would be in potentially competing states. It'd take more investigation to know for sure what the behavior would be.

We released a fix for this issue in version 2.6.2.

Was this page helpful?
0 / 5 - 0 ratings