2016-03-17 127 views
0

我正在使用Template10構建Windows 10的UWP應用程序。我想使用MS Application Insights。在我的項目中,我提到:Microsoft.ApplicationInsights(2.0.0),(1.2.3),Microsoft.ApplicationInsights.WindowsApps(1.1.1)。在App構造函數中,我要下面的代碼:應用程序洞察使應用程序在啓動時凍結

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 
} 

我還添加了一個正確的InstrumentationKey從Azure中的ApplicationInsights.config像這樣:

<?xml version="1.0" encoding="utf-8" ?> 
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings"> 
    <InstrumentationKey>my-key</InstrumentationKey> 
</ApplicationInsights> 

然而,當我啓動我的應用程序,它只是掛在應用程序的標誌。當我評論WindowsAppInitializer.InitializeAsync();行時,該應用程序正常工作。

我已嘗試從項目中刪除並讀取所提及的參考,刪除並重新安裝Visual Studio的Application Insights工具,但沒有成功。

當我創建一個新的空白應用程序(通用Windows)時,Visual Studio會自動設置應用程序見解並按預期工作。但我無法讓它與我現有的項目一起工作。

請幫忙。

回答

2

有關在UWP應用程序中使用Application Insights的故事不贊成使用HockeyApp,並且在UWP上有AI 2.0.0的已知問題。

https://github.com/Microsoft/ApplicationInsights-dotnet/issues/210

+1

我甚至想降級應用洞察包1.2.3。,這種方式的應用程序的作品,但見解不:(但是,您的鏈接導致我的[文章](https://azure.microsoft.com/en-us/blog/transitioning-mobile從4月15日起,MS將不再接受使用AI的新UWP應用程序,並在6月15日完全關閉該服務。所以,看起來像我所有的努力下降了他流失了。我仍然不明白,他們如何用這種劣質產品取代人工智能(HockeyApp)。 –

1

就是剛纔我有完全相同的問題,我終於成功地完成這項工作。因此,改變依賴於project.json像她那樣:

"dependencies": { 
    ... 
    "Microsoft.ApplicationInsights": "1.0.0", 
    "Microsoft.ApplicationInsights.PersistenceChannel": "1.0.0", 
    "Microsoft.ApplicationInsights.WindowsApps": "1.0.0" 
}, 

如果這不會幫助我還建議將儀器關鍵WindowsAppInitializer:

WindowsAppInitializer.InitializeAsync("YOURKEY");