簡體   English   中英

應用程序見解使應用程序在啟動時凍結

[英]Application insights make the app freeze on startup

我正在使用Template10為Windows 10構建UWP應用程序。 我想使用MS Application Insights。 在我的項目中,我引用了: Microsoft.ApplicationInsights (2.0.0), Microsoft.ApplicationInsights.PersistenceChannel (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
}

我還從Azure將正確的InstrumentationKey添加到了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工具,但是沒有成功。

當我創建一個新的Blank App(通用Windows)時,Visual Studio會自動設置Application Insights,並且可以按預期工作。 但是我無法使其與我現有的項目一起使用。

請幫忙。

不贊成在UWP應用中使用Application Insights的故事,而推薦使用HockeyApp,並且在UWP上存在AI 2.0.0的已知問題。

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

不久前,我遇到了完全相同的問題,終於設法完成了這項工作。 因此,將project.json中的依賴項更改為如下所示:

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

如果這樣做沒有幫助,我還建議向WindowsAppInitializer添加檢測密鑰:

WindowsAppInitializer.InitializeAsync("YOURKEY");

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM