I'm building a UWP application for Windows 10 using Template10. I would like to use MS Application Insights. In my project, I have references to: Microsoft.ApplicationInsights
(2.0.0), Microsoft.ApplicationInsights.PersistenceChannel
(1.2.3), Microsoft.ApplicationInsights.WindowsApps
(1.1.1). In the App constructor, I have to following code:
public App()
{
WindowsAppInitializer.InitializeAsync();
InitializeComponent();
SplashFactory = (e) => new Views.Splash(e);
#region App settings
_settings = SettingsService.Instance;
RequestedTheme = _settings.AppTheme;
CacheMaxDuration = _settings.CacheMaxDuration;
ShowShellBackButton = _settings.UseShellBackButton;
#endregion
}
I have also added a correct InstrumentationKey from Azure to the ApplicationInsights.config
like so:
<?xml version="1.0" encoding="utf-8" ?>
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
<InstrumentationKey>my-key</InstrumentationKey>
</ApplicationInsights>
However, when I launch my app, it simply hangs at the app logo. When I comment the WindowsAppInitializer.InitializeAsync();
line out, the app works normal.
I have tried removing and readding the mentioned references from the project, removing and reinstalling Application Insights Tools for Visual Studio, but without a success.
When I create a new Blank App (Universal Windows), Visual Studio sets up the Application Insights automatically and it works as expected. But I cannot get it to work with my existing project.
Please help.
The story around using Application Insights in UWP apps is being deprecated in favor of HockeyApp, and there is a known issue with AI 2.0.0 on UWP.
See https://github.com/Microsoft/ApplicationInsights-dotnet/issues/210