AppCenter to AppInsights migration. (#562)
* Remove AppCenter usage and libraries. * Remove redundant pacakges and add the app insights sink. * Diagnostic id support and manipulating telemetries. * Handling of appdomain unhandled exceptions. * Remove unused package identity package from mail project. * Fixing printing.
This commit is contained in:
@@ -20,8 +20,6 @@
|
|||||||
<PackageVersion Include="HtmlAgilityPack" Version="1.11.72" />
|
<PackageVersion Include="HtmlAgilityPack" Version="1.11.72" />
|
||||||
<PackageVersion Include="Ical.Net" Version="4.3.1" />
|
<PackageVersion Include="Ical.Net" Version="4.3.1" />
|
||||||
<PackageVersion Include="IsExternalInit" Version="1.0.3" />
|
<PackageVersion Include="IsExternalInit" Version="1.0.3" />
|
||||||
<PackageVersion Include="Microsoft.AppCenter.Analytics" Version="5.0.6" />
|
|
||||||
<PackageVersion Include="Microsoft.AppCenter.Crashes" Version="5.0.6" />
|
|
||||||
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" />
|
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" />
|
||||||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0" />
|
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0" />
|
||||||
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.2" />
|
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.2" />
|
||||||
@@ -42,6 +40,7 @@
|
|||||||
<PackageVersion Include="Serilog.Exceptions" Version="8.4.0" />
|
<PackageVersion Include="Serilog.Exceptions" Version="8.4.0" />
|
||||||
<PackageVersion Include="Serilog.Sinks.Debug" Version="3.0.0" />
|
<PackageVersion Include="Serilog.Sinks.Debug" Version="3.0.0" />
|
||||||
<PackageVersion Include="Serilog.Sinks.File" Version="6.0.0" />
|
<PackageVersion Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||||
|
<PackageVersion Include="Serilog.Sinks.ApplicationInsights" Version="4.0.0" />
|
||||||
<PackageVersion Include="SkiaSharp" Version="3.116.1" />
|
<PackageVersion Include="SkiaSharp" Version="3.116.1" />
|
||||||
<PackageVersion Include="sqlite-net-pcl" Version="1.9.172" />
|
<PackageVersion Include="sqlite-net-pcl" Version="1.9.172" />
|
||||||
<PackageVersion Include="SqlKata" Version="4.0.1" />
|
<PackageVersion Include="SqlKata" Version="4.0.1" />
|
||||||
|
|||||||
@@ -23,5 +23,10 @@
|
|||||||
/// Files here are short-lived and can be deleted by system.
|
/// Files here are short-lived and can be deleted by system.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string ApplicationTempFolderPath { get; set; }
|
string ApplicationTempFolderPath { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Application insights instrumentation key.
|
||||||
|
/// </summary>
|
||||||
|
string ApplicationInsightsInstrumentationKey { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -187,6 +187,7 @@ namespace Wino.Core.Domain.Interfaces
|
|||||||
DayOfWeek WorkingDayStart { get; set; }
|
DayOfWeek WorkingDayStart { get; set; }
|
||||||
DayOfWeek WorkingDayEnd { get; set; }
|
DayOfWeek WorkingDayEnd { get; set; }
|
||||||
double HourHeight { get; set; }
|
double HourHeight { get; set; }
|
||||||
|
string DiagnosticId { get; set; }
|
||||||
|
|
||||||
CalendarSettings GetCurrentCalendarSettings();
|
CalendarSettings GetCurrentCalendarSettings();
|
||||||
|
|
||||||
|
|||||||
@@ -451,6 +451,8 @@
|
|||||||
"SettingsDeleteProtection_Title": "Permanent Delete Protection",
|
"SettingsDeleteProtection_Title": "Permanent Delete Protection",
|
||||||
"SettingsDiagnostics_Description": "For developers",
|
"SettingsDiagnostics_Description": "For developers",
|
||||||
"SettingsDiagnostics_Title": "Diagnostics",
|
"SettingsDiagnostics_Title": "Diagnostics",
|
||||||
|
"SettingsDiagnostics_DiagnosticId_Title": "Diagnostic Id",
|
||||||
|
"SettingsDiagnostics_DiagnosticId_Description": "Share this Id with the developers when asked to get help for the issues you experience in Wino Mail.",
|
||||||
"SettingsDiscord_Description": "Get regular development updates, join roadmap discussions and provide feedback.",
|
"SettingsDiscord_Description": "Get regular development updates, join roadmap discussions and provide feedback.",
|
||||||
"SettingsDiscord_Title": "Discord Channel",
|
"SettingsDiscord_Title": "Discord Channel",
|
||||||
"SettingsElementThemeSelectionDisabled": "Element theme selection is disabled when application theme is selected other than Default.",
|
"SettingsElementThemeSelectionDisabled": "Element theme selection is disabled when application theme is selected other than Default.",
|
||||||
|
|||||||
@@ -229,6 +229,12 @@ namespace Wino.Core.UWP.Services
|
|||||||
set => SaveProperty(propertyName: nameof(ServerTerminationBehavior), value);
|
set => SaveProperty(propertyName: nameof(ServerTerminationBehavior), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string DiagnosticId
|
||||||
|
{
|
||||||
|
get => _configurationService.Get(nameof(DiagnosticId), Guid.NewGuid().ToString());
|
||||||
|
set => SaveProperty(propertyName: nameof(DiagnosticId), value);
|
||||||
|
}
|
||||||
|
|
||||||
public DayOfWeek FirstDayOfWeek
|
public DayOfWeek FirstDayOfWeek
|
||||||
{
|
{
|
||||||
get => _configurationService.Get(nameof(FirstDayOfWeek), DayOfWeek.Monday);
|
get => _configurationService.Get(nameof(FirstDayOfWeek), DayOfWeek.Monday);
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
<SolidColorBrush x:Key="FolderSyncBrush">#1abc9c</SolidColorBrush>
|
<SolidColorBrush x:Key="FolderSyncBrush">#1abc9c</SolidColorBrush>
|
||||||
|
|
||||||
|
<SolidColorBrush x:Key="DiagnosticIdCopyBrush">#ff7675</SolidColorBrush>
|
||||||
<SolidColorBrush x:Key="AliasUnverifiedBrush">#ff7675</SolidColorBrush>
|
<SolidColorBrush x:Key="AliasUnverifiedBrush">#ff7675</SolidColorBrush>
|
||||||
<SolidColorBrush x:Key="AliasVerifiedBrush">#1abc9c</SolidColorBrush>
|
<SolidColorBrush x:Key="AliasVerifiedBrush">#1abc9c</SolidColorBrush>
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,6 @@
|
|||||||
<PackageReference Include="CommunityToolkit.Uwp.Extensions" />
|
<PackageReference Include="CommunityToolkit.Uwp.Extensions" />
|
||||||
<PackageReference Include="CommunityToolkit.WinUI.Notifications" />
|
<PackageReference Include="CommunityToolkit.WinUI.Notifications" />
|
||||||
<PackageReference Include="CommunityToolkit.Uwp.Controls.TabbedCommandBar" />
|
<PackageReference Include="CommunityToolkit.Uwp.Controls.TabbedCommandBar" />
|
||||||
<PackageReference Include="Microsoft.AppCenter.Analytics" />
|
|
||||||
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" />
|
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" />
|
||||||
<PackageReference Include="Win2D.uwp" />
|
<PackageReference Include="Win2D.uwp" />
|
||||||
<PackageReference Include="EmailValidation" />
|
<PackageReference Include="EmailValidation" />
|
||||||
|
|||||||
@@ -3,9 +3,6 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AppCenter;
|
|
||||||
using Microsoft.AppCenter.Analytics;
|
|
||||||
using Microsoft.AppCenter.Crashes;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Nito.AsyncEx;
|
using Nito.AsyncEx;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
@@ -40,24 +37,16 @@ namespace Wino.Core.UWP
|
|||||||
protected IDatabaseService DatabaseService { get; }
|
protected IDatabaseService DatabaseService { get; }
|
||||||
protected ITranslationService TranslationService { get; }
|
protected ITranslationService TranslationService { get; }
|
||||||
|
|
||||||
// Order matters.
|
|
||||||
private List<IInitializeAsync> initializeServices => new List<IInitializeAsync>()
|
|
||||||
{
|
|
||||||
DatabaseService,
|
|
||||||
TranslationService,
|
|
||||||
ThemeService,
|
|
||||||
};
|
|
||||||
|
|
||||||
public abstract string AppCenterKey { get; }
|
|
||||||
|
|
||||||
protected WinoApplication()
|
protected WinoApplication()
|
||||||
{
|
{
|
||||||
ConfigureAppCenter();
|
|
||||||
ConfigurePrelaunch();
|
ConfigurePrelaunch();
|
||||||
|
|
||||||
Services = ConfigureServices();
|
Services = ConfigureServices();
|
||||||
|
|
||||||
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||||
|
TaskScheduler.UnobservedTaskException += OnUnobservedTaskException;
|
||||||
UnhandledException += OnAppUnhandledException;
|
UnhandledException += OnAppUnhandledException;
|
||||||
|
|
||||||
Resuming += OnResuming;
|
Resuming += OnResuming;
|
||||||
Suspending += OnSuspending;
|
Suspending += OnSuspending;
|
||||||
|
|
||||||
@@ -77,6 +66,18 @@ namespace Wino.Core.UWP
|
|||||||
ConfigureLogging();
|
ConfigureLogging();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CurrentDomain_UnhandledException(object sender, System.UnhandledExceptionEventArgs e)
|
||||||
|
=> Log.Fatal(e.ExceptionObject as Exception, "AppDomain Unhandled Exception");
|
||||||
|
|
||||||
|
private void OnUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
|
||||||
|
=> Log.Error(e.Exception, "Unobserved Task Exception");
|
||||||
|
|
||||||
|
private void OnAppUnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
|
||||||
|
{
|
||||||
|
Log.Fatal(e.Exception, "Unhandled Exception");
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract void OnApplicationCloseRequested(object sender, SystemNavigationCloseRequestedPreviewEventArgs e);
|
protected abstract void OnApplicationCloseRequested(object sender, SystemNavigationCloseRequestedPreviewEventArgs e);
|
||||||
protected abstract IEnumerable<ActivationHandler> GetActivationHandlers();
|
protected abstract IEnumerable<ActivationHandler> GetActivationHandlers();
|
||||||
protected abstract ActivationHandler<IActivatedEventArgs> GetDefaultActivationHandler();
|
protected abstract ActivationHandler<IActivatedEventArgs> GetDefaultActivationHandler();
|
||||||
@@ -208,29 +209,12 @@ namespace Wino.Core.UWP
|
|||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void ConfigurePrelaunch()
|
private void ConfigurePrelaunch()
|
||||||
{
|
{
|
||||||
if (ApiInformation.IsMethodPresent("Windows.ApplicationModel.Core.CoreApplication", "EnablePrelaunch"))
|
if (ApiInformation.IsMethodPresent("Windows.ApplicationModel.Core.CoreApplication", "EnablePrelaunch"))
|
||||||
CoreApplication.EnablePrelaunch(true);
|
CoreApplication.EnablePrelaunch(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAppUnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
|
|
||||||
{
|
|
||||||
var parameters = new Dictionary<string, string>()
|
|
||||||
{
|
|
||||||
{ "BaseMessage", e.Exception.GetBaseException().Message },
|
|
||||||
{ "BaseStackTrace", e.Exception.GetBaseException().StackTrace },
|
|
||||||
{ "StackTrace", e.Exception.StackTrace },
|
|
||||||
{ "Message", e.Exception.Message },
|
|
||||||
};
|
|
||||||
|
|
||||||
Log.Error(e.Exception, "[Wino Crash]");
|
|
||||||
|
|
||||||
Crashes.TrackError(e.Exception, parameters);
|
|
||||||
Analytics.TrackEvent("Wino Crashed", parameters);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public virtual async void OnResuming(object sender, object e)
|
public virtual async void OnResuming(object sender, object e)
|
||||||
@@ -255,8 +239,6 @@ namespace Wino.Core.UWP
|
|||||||
public virtual void OnSuspending(object sender, SuspendingEventArgs e) { }
|
public virtual void OnSuspending(object sender, SuspendingEventArgs e) { }
|
||||||
|
|
||||||
public abstract IServiceProvider ConfigureServices();
|
public abstract IServiceProvider ConfigureServices();
|
||||||
public void ConfigureAppCenter()
|
|
||||||
=> AppCenter.Start(AppCenterKey, typeof(Analytics), typeof(Crashes));
|
|
||||||
|
|
||||||
public void ConfigureLogging()
|
public void ConfigureLogging()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using Serilog;
|
||||||
using Wino.Core.Domain;
|
using Wino.Core.Domain;
|
||||||
using Wino.Core.Domain.Enums;
|
using Wino.Core.Domain.Enums;
|
||||||
using Wino.Core.Domain.Interfaces;
|
using Wino.Core.Domain.Interfaces;
|
||||||
@@ -13,6 +14,7 @@ namespace Wino.Core.ViewModels
|
|||||||
private readonly IMailDialogService _dialogService;
|
private readonly IMailDialogService _dialogService;
|
||||||
private readonly INativeAppService _nativeAppService;
|
private readonly INativeAppService _nativeAppService;
|
||||||
private readonly IApplicationConfiguration _appInitializerService;
|
private readonly IApplicationConfiguration _appInitializerService;
|
||||||
|
private readonly IClipboardService _clipboardService;
|
||||||
private readonly IFileService _fileService;
|
private readonly IFileService _fileService;
|
||||||
private readonly ILogInitializer _logInitializer;
|
private readonly ILogInitializer _logInitializer;
|
||||||
|
|
||||||
@@ -29,6 +31,7 @@ namespace Wino.Core.ViewModels
|
|||||||
INativeAppService nativeAppService,
|
INativeAppService nativeAppService,
|
||||||
IPreferencesService preferencesService,
|
IPreferencesService preferencesService,
|
||||||
IApplicationConfiguration appInitializerService,
|
IApplicationConfiguration appInitializerService,
|
||||||
|
IClipboardService clipboardService,
|
||||||
IFileService fileService,
|
IFileService fileService,
|
||||||
ILogInitializer logInitializer)
|
ILogInitializer logInitializer)
|
||||||
{
|
{
|
||||||
@@ -37,6 +40,7 @@ namespace Wino.Core.ViewModels
|
|||||||
_nativeAppService = nativeAppService;
|
_nativeAppService = nativeAppService;
|
||||||
_logInitializer = logInitializer;
|
_logInitializer = logInitializer;
|
||||||
_appInitializerService = appInitializerService;
|
_appInitializerService = appInitializerService;
|
||||||
|
_clipboardService = clipboardService;
|
||||||
_fileService = fileService;
|
_fileService = fileService;
|
||||||
|
|
||||||
PreferencesService = preferencesService;
|
PreferencesService = preferencesService;
|
||||||
@@ -65,6 +69,21 @@ namespace Wino.Core.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task CopyDiagnosticId()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _clipboardService.CopyClipboardAsync(PreferencesService.DiagnosticId);
|
||||||
|
_dialogService.InfoBarMessage(Translator.Buttons_Copy, string.Format(Translator.ClipboardTextCopied_Message, "Id"), InfoBarMessageType.Success);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_dialogService.InfoBarMessage(Translator.GeneralTitle_Error, string.Format(Translator.ClipboardTextCopyFailed_Message, "Id"), InfoBarMessageType.Error);
|
||||||
|
Log.Error(ex, "Failed to copy diagnostic id to clipboard.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private async Task ShareWinoLogAsync()
|
private async Task ShareWinoLogAsync()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AppCenter.Crashes" />
|
|
||||||
<PackageReference Include="Microsoft.Identity.Client" />
|
<PackageReference Include="Microsoft.Identity.Client" />
|
||||||
<PackageReference Include="System.Reactive" />
|
<PackageReference Include="System.Reactive" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -26,10 +26,6 @@
|
|||||||
<PackageReference Include="morelinq" />
|
<PackageReference Include="morelinq" />
|
||||||
<PackageReference Include="Nito.AsyncEx.Tasks" />
|
<PackageReference Include="Nito.AsyncEx.Tasks" />
|
||||||
<PackageReference Include="NodaTime" />
|
<PackageReference Include="NodaTime" />
|
||||||
<PackageReference Include="Serilog" />
|
|
||||||
<PackageReference Include="Serilog.Exceptions" />
|
|
||||||
<PackageReference Include="Serilog.Sinks.Debug" />
|
|
||||||
<PackageReference Include="Serilog.Sinks.File" />
|
|
||||||
<PackageReference Include="SkiaSharp" />
|
<PackageReference Include="SkiaSharp" />
|
||||||
<PackageReference Include="SqlKata" />
|
<PackageReference Include="SqlKata" />
|
||||||
<PackageReference Include="System.Text.Encoding.CodePages" />
|
<PackageReference Include="System.Text.Encoding.CodePages" />
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
namespace Wino.Core
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Error codes for Wino application.
|
|
||||||
/// Pretty outdated.
|
|
||||||
/// </summary>
|
|
||||||
public static class WinoErrors
|
|
||||||
{
|
|
||||||
public const string AccountStructureRender = nameof(AccountStructureRender);
|
|
||||||
public const string MimeRendering = nameof(MimeRendering);
|
|
||||||
public const string MailRendering = nameof(MailRendering);
|
|
||||||
public const string FolderOperationExecution = nameof(FolderOperationExecution);
|
|
||||||
public const string StartupAccountExtendFail = nameof(StartupAccountExtendFail);
|
|
||||||
public const string AccountNavigateInboxFail = nameof(AccountNavigateInboxFail);
|
|
||||||
public const string AccountCreation = nameof(AccountCreation);
|
|
||||||
|
|
||||||
public const string OutlookIntegratorFolderSync = nameof(OutlookIntegratorFolderSync);
|
|
||||||
public const string GoogleSynchronizerAccountSync = nameof(GoogleSynchronizerAccountSync);
|
|
||||||
public const string ImapFolderSync = nameof(ImapFolderSync);
|
|
||||||
|
|
||||||
public const string RendererCommandMailOperation = nameof(RendererCommandMailOperation);
|
|
||||||
public const string MailListingMailOperation = nameof(MailListingMailOperation);
|
|
||||||
|
|
||||||
public const string AutoMarkAsRead = nameof(AutoMarkAsRead);
|
|
||||||
public const string MailListGetItem = nameof(MailListGetItem);
|
|
||||||
public const string MailListCollectionUpdate = nameof(MailListCollectionUpdate);
|
|
||||||
public const string MailListRefreshFolder = nameof(MailListRefreshFolder);
|
|
||||||
public const string ProcessorTaskFailed = nameof(ProcessorTaskFailed);
|
|
||||||
public const string SearchFailed = nameof(SearchFailed);
|
|
||||||
|
|
||||||
public const string BatchExecutionFailed = nameof(BatchExecutionFailed);
|
|
||||||
public const string SingleBatchExecutionFailedGoogle = nameof(SingleBatchExecutionFailedGoogle);
|
|
||||||
|
|
||||||
public const string SynchronizationWorkerException = nameof(SynchronizationWorkerException);
|
|
||||||
public const string StoreRatingSubmission = nameof(StoreRatingSubmission);
|
|
||||||
|
|
||||||
public const string OpenAttachment = nameof(OpenAttachment);
|
|
||||||
public const string SaveAttachment = nameof(SaveAttachment);
|
|
||||||
|
|
||||||
public const string OutlookMimeSaveFailure = nameof(OutlookMimeSaveFailure);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,9 +5,7 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using CommunityToolkit.Mvvm.Messaging;
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
using Microsoft.AppCenter.Crashes;
|
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Wino.Core;
|
|
||||||
using Wino.Core.Domain;
|
using Wino.Core.Domain;
|
||||||
using Wino.Core.Domain.Entities.Mail;
|
using Wino.Core.Domain.Entities.Mail;
|
||||||
using Wino.Core.Domain.Entities.Shared;
|
using Wino.Core.Domain.Entities.Shared;
|
||||||
@@ -274,8 +272,7 @@ namespace Wino.Mail.ViewModels
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log.Error(ex, WinoErrors.AccountCreation);
|
Log.Error(ex, "Failed to create account.");
|
||||||
Crashes.TrackError(ex);
|
|
||||||
|
|
||||||
DialogService.InfoBarMessage(Translator.Info_AccountCreationFailedTitle, ex.Message, InfoBarMessageType.Error);
|
DialogService.InfoBarMessage(Translator.Info_AccountCreationFailedTitle, ex.Message, InfoBarMessageType.Error);
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,9 @@ using System.Threading.Tasks;
|
|||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using CommunityToolkit.Mvvm.Messaging;
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
using Microsoft.AppCenter.Crashes;
|
|
||||||
using MoreLinq;
|
using MoreLinq;
|
||||||
using MoreLinq.Extensions;
|
using MoreLinq.Extensions;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Wino.Core;
|
|
||||||
using Wino.Core.Domain;
|
using Wino.Core.Domain;
|
||||||
using Wino.Core.Domain.Entities.Mail;
|
using Wino.Core.Domain.Entities.Mail;
|
||||||
using Wino.Core.Domain.Entities.Shared;
|
using Wino.Core.Domain.Entities.Shared;
|
||||||
@@ -301,7 +299,7 @@ namespace Wino.Mail.ViewModels
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Crashes.TrackError(ex);
|
Log.Error(ex, "Failed to configure background tasks.");
|
||||||
|
|
||||||
_dialogService.InfoBarMessage(Translator.Info_BackgroundExecutionUnknownErrorTitle, Translator.Info_BackgroundExecutionUnknownErrorMessage, InfoBarMessageType.Error);
|
_dialogService.InfoBarMessage(Translator.Info_BackgroundExecutionUnknownErrorTitle, Translator.Info_BackgroundExecutionUnknownErrorMessage, InfoBarMessageType.Error);
|
||||||
}
|
}
|
||||||
@@ -373,7 +371,7 @@ namespace Wino.Mail.ViewModels
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log.Error(ex, WinoErrors.StartupAccountExtendFail);
|
Log.Error(ex, "Failed to process launch options.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -474,7 +472,7 @@ namespace Wino.Mail.ViewModels
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log.Error(ex, WinoErrors.AccountNavigateInboxFail);
|
Log.Error(ex, "Failed to navigate to Inbox.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,11 +10,9 @@ using System.Threading.Tasks;
|
|||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using CommunityToolkit.Mvvm.Messaging;
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
using Microsoft.AppCenter.Crashes;
|
|
||||||
using MoreLinq;
|
using MoreLinq;
|
||||||
using Nito.AsyncEx;
|
using Nito.AsyncEx;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Wino.Core;
|
|
||||||
using Wino.Core.Domain;
|
using Wino.Core.Domain;
|
||||||
using Wino.Core.Domain.Entities.Mail;
|
using Wino.Core.Domain.Entities.Mail;
|
||||||
using Wino.Core.Domain.Entities.Shared;
|
using Wino.Core.Domain.Entities.Shared;
|
||||||
@@ -844,11 +842,9 @@ namespace Wino.Mail.ViewModels
|
|||||||
Debugger.Break();
|
Debugger.Break();
|
||||||
|
|
||||||
if (IsInSearchMode)
|
if (IsInSearchMode)
|
||||||
Log.Error(ex, WinoErrors.SearchFailed);
|
Log.Error(ex, "Failed to perform search.");
|
||||||
else
|
else
|
||||||
Log.Error(ex, WinoErrors.MailListRefreshFolder);
|
Log.Error(ex, "Failed to refresh listed mails.");
|
||||||
|
|
||||||
Crashes.TrackError(ex);
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,10 +9,9 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
|||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using CommunityToolkit.Mvvm.Messaging;
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
using MailKit;
|
using MailKit;
|
||||||
using Microsoft.AppCenter.Crashes;
|
|
||||||
using MimeKit;
|
using MimeKit;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Wino.Core;
|
|
||||||
using Wino.Core.Domain;
|
using Wino.Core.Domain;
|
||||||
using Wino.Core.Domain.Entities.Mail;
|
using Wino.Core.Domain.Entities.Mail;
|
||||||
using Wino.Core.Domain.Entities.Shared;
|
using Wino.Core.Domain.Entities.Shared;
|
||||||
@@ -345,8 +344,7 @@ namespace Wino.Mail.ViewModels
|
|||||||
{
|
{
|
||||||
_dialogService.InfoBarMessage(Translator.Info_MailRenderingFailedTitle, string.Format(Translator.Info_MailRenderingFailedMessage, ex.Message), InfoBarMessageType.Error);
|
_dialogService.InfoBarMessage(Translator.Info_MailRenderingFailedTitle, string.Format(Translator.Info_MailRenderingFailedMessage, ex.Message), InfoBarMessageType.Error);
|
||||||
|
|
||||||
Crashes.TrackError(ex);
|
Log.Error(ex, "Failed to render mail.");
|
||||||
Log.Error(ex, "Render Failed");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -616,8 +614,7 @@ namespace Wino.Mail.ViewModels
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log.Error(ex, WinoErrors.OpenAttachment);
|
Log.Error(ex, "Failed to open attachment.");
|
||||||
Crashes.TrackError(ex);
|
|
||||||
|
|
||||||
_dialogService.InfoBarMessage(Translator.Info_AttachmentOpenFailedTitle, Translator.Info_AttachmentOpenFailedMessage, InfoBarMessageType.Error);
|
_dialogService.InfoBarMessage(Translator.Info_AttachmentOpenFailedTitle, Translator.Info_AttachmentOpenFailedMessage, InfoBarMessageType.Error);
|
||||||
}
|
}
|
||||||
@@ -643,8 +640,7 @@ namespace Wino.Mail.ViewModels
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log.Error(ex, WinoErrors.SaveAttachment);
|
Log.Error(ex, "Failed to save attachment.");
|
||||||
Crashes.TrackError(ex);
|
|
||||||
|
|
||||||
_dialogService.InfoBarMessage(Translator.Info_AttachmentSaveFailedTitle, Translator.Info_AttachmentSaveFailedMessage, InfoBarMessageType.Error);
|
_dialogService.InfoBarMessage(Translator.Info_AttachmentSaveFailedTitle, Translator.Info_AttachmentSaveFailedMessage, InfoBarMessageType.Error);
|
||||||
}
|
}
|
||||||
@@ -673,8 +669,7 @@ namespace Wino.Mail.ViewModels
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log.Error(ex, WinoErrors.SaveAttachment);
|
Log.Error(ex, "Failed to save attachment.");
|
||||||
Crashes.TrackError(ex);
|
|
||||||
|
|
||||||
_dialogService.InfoBarMessage(Translator.Info_AttachmentSaveFailedTitle, Translator.Info_AttachmentSaveFailedMessage, InfoBarMessageType.Error);
|
_dialogService.InfoBarMessage(Translator.Info_AttachmentSaveFailedTitle, Translator.Info_AttachmentSaveFailedMessage, InfoBarMessageType.Error);
|
||||||
}
|
}
|
||||||
@@ -709,8 +704,8 @@ namespace Wino.Mail.ViewModels
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Log.Error(ex, "Failed to print mail.");
|
||||||
_dialogService.InfoBarMessage(string.Empty, ex.Message, InfoBarMessageType.Error);
|
_dialogService.InfoBarMessage(string.Empty, ex.Message, InfoBarMessageType.Error);
|
||||||
Crashes.TrackError(ex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -735,8 +730,8 @@ namespace Wino.Mail.ViewModels
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Log.Error(ex, "Failed to save as PDF.");
|
||||||
_dialogService.InfoBarMessage(Translator.Info_PDFSaveFailedTitle, ex.Message, InfoBarMessageType.Error);
|
_dialogService.InfoBarMessage(Translator.Info_PDFSaveFailedTitle, ex.Message, InfoBarMessageType.Error);
|
||||||
Crashes.TrackError(ex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -786,8 +781,7 @@ namespace Wino.Mail.ViewModels
|
|||||||
{
|
{
|
||||||
_dialogService.InfoBarMessage(Translator.Info_MailRenderingFailedTitle, string.Format(Translator.Info_MailRenderingFailedMessage, ex.Message), InfoBarMessageType.Error);
|
_dialogService.InfoBarMessage(Translator.Info_MailRenderingFailedTitle, string.Format(Translator.Info_MailRenderingFailedMessage, ex.Message), InfoBarMessageType.Error);
|
||||||
|
|
||||||
Crashes.TrackError(ex);
|
Log.Error(ex, "Failed to render mail.");
|
||||||
Log.Error(ex, "Render Failed");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,9 @@
|
|||||||
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="EmailValidation" />
|
<PackageReference Include="EmailValidation" />
|
||||||
<PackageReference Include="Microsoft.AppCenter.Crashes" />
|
<PackageReference Include="Microsoft.Identity.Client" />
|
||||||
<PackageReference Include="Microsoft.Identity.Client" />
|
<PackageReference Include="System.Reactive" />
|
||||||
<PackageReference Include="System.Reactive" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Wino.Core.Domain\Wino.Core.Domain.csproj" />
|
<ProjectReference Include="..\Wino.Core.Domain\Wino.Core.Domain.csproj" />
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ namespace Wino
|
|||||||
{
|
{
|
||||||
public sealed partial class App : WinoApplication, IRecipient<NewMailSynchronizationRequested>
|
public sealed partial class App : WinoApplication, IRecipient<NewMailSynchronizationRequested>
|
||||||
{
|
{
|
||||||
public override string AppCenterKey { get; } = "90deb1d0-a77f-47d0-8a6b-7eaf111c6b72";
|
|
||||||
|
|
||||||
private BackgroundTaskDeferral connectionBackgroundTaskDeferral;
|
private BackgroundTaskDeferral connectionBackgroundTaskDeferral;
|
||||||
private BackgroundTaskDeferral toastActionBackgroundTaskDeferral;
|
private BackgroundTaskDeferral toastActionBackgroundTaskDeferral;
|
||||||
|
|
||||||
|
|||||||
@@ -139,6 +139,31 @@
|
|||||||
<ToggleSwitch IsOn="{x:Bind ViewModel.PreferencesService.IsLoggingEnabled, Mode=TwoWay}" />
|
<ToggleSwitch IsOn="{x:Bind ViewModel.PreferencesService.IsLoggingEnabled, Mode=TwoWay}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</controls:SettingsCard>
|
</controls:SettingsCard>
|
||||||
|
<controls:SettingsCard
|
||||||
|
HorizontalContentAlignment="Stretch"
|
||||||
|
VerticalContentAlignment="Stretch"
|
||||||
|
ContentAlignment="Vertical"
|
||||||
|
Description="{x:Bind domain:Translator.SettingsDiagnostics_DiagnosticId_Description}"
|
||||||
|
Header="{x:Bind domain:Translator.SettingsDiagnostics_DiagnosticId_Title}">
|
||||||
|
<StackPanel Orientation="Horizontal" Spacing="16">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
Grid.Column="1"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Command="{x:Bind ViewModel.CopyDiagnosticIdCommand}">
|
||||||
|
<PathIcon
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Data="F1 M 10.556641 15 C 10.146484 15 9.755859 14.916992 9.384766 14.750977 C 9.013672 14.584961 8.689778 14.363607 8.413086 14.086914 C 8.136393 13.810222 7.915039 13.486328 7.749023 13.115234 C 7.583007 12.744141 7.5 12.353516 7.5 11.943359 L 7.5 4.306641 C 7.5 3.896484 7.583007 3.505859 7.749023 3.134766 C 7.915039 2.763672 8.136393 2.439779 8.413086 2.163086 C 8.689778 1.886395 9.013672 1.665039 9.384766 1.499023 C 9.755859 1.333008 10.146484 1.25 10.556641 1.25 L 15.693359 1.25 C 16.103516 1.25 16.494141 1.333008 16.865234 1.499023 C 17.236328 1.665039 17.560221 1.886395 17.836914 2.163086 C 18.113605 2.439779 18.334961 2.763672 18.500977 3.134766 C 18.666992 3.505859 18.75 3.896484 18.75 4.306641 L 18.75 11.943359 C 18.75 12.353516 18.666992 12.744141 18.500977 13.115234 C 18.334961 13.486328 18.113605 13.810222 17.836914 14.086914 C 17.560221 14.363607 17.236328 14.584961 16.865234 14.750977 C 16.494141 14.916992 16.103516 15 15.693359 15 Z M 15.625 13.75 C 15.878906 13.75 16.119791 13.701172 16.347656 13.603516 C 16.57552 13.505859 16.775715 13.370769 16.948242 13.198242 C 17.120768 13.025717 17.255859 12.825521 17.353516 12.597656 C 17.451172 12.369792 17.5 12.128906 17.5 11.875 L 17.5 4.375 C 17.5 4.121094 17.451172 3.880209 17.353516 3.652344 C 17.255859 3.42448 17.120768 3.224285 16.948242 3.051758 C 16.775715 2.879232 16.57552 2.744141 16.347656 2.646484 C 16.119791 2.548828 15.878906 2.5 15.625 2.5 L 10.625 2.5 C 10.371094 2.5 10.130208 2.548828 9.902344 2.646484 C 9.674479 2.744141 9.474283 2.879232 9.301758 3.051758 C 9.129231 3.224285 8.994141 3.42448 8.896484 3.652344 C 8.798828 3.880209 8.75 4.121094 8.75 4.375 L 8.75 11.875 C 8.75 12.128906 8.798828 12.369792 8.896484 12.597656 C 8.994141 12.825521 9.129231 13.025717 9.301758 13.198242 C 9.474283 13.370769 9.674479 13.505859 9.902344 13.603516 C 10.130208 13.701172 10.371094 13.75 10.625 13.75 Z M 4.306641 18.75 C 3.896484 18.75 3.505859 18.666992 3.134766 18.500977 C 2.763672 18.334961 2.439779 18.113607 2.163086 17.836914 C 1.886393 17.560221 1.665039 17.236328 1.499023 16.865234 C 1.333008 16.494141 1.25 16.103516 1.25 15.693359 L 1.25 8.056641 C 1.25 7.646484 1.333008 7.255859 1.499023 6.884766 C 1.665039 6.513672 1.886393 6.189779 2.163086 5.913086 C 2.439779 5.636395 2.763672 5.41504 3.134766 5.249023 C 3.505859 5.083009 3.896484 5.000001 4.306641 5 L 6.25 5 L 6.25 6.25 L 4.375 6.25 C 4.121094 6.25 3.880208 6.298828 3.652344 6.396484 C 3.424479 6.494141 3.224284 6.629232 3.051758 6.801758 C 2.879232 6.974284 2.744141 7.174479 2.646484 7.402344 C 2.548828 7.630209 2.5 7.871094 2.5 8.125 L 2.5 15.625 C 2.5 15.878906 2.548828 16.119791 2.646484 16.347656 C 2.744141 16.575521 2.879232 16.775717 3.051758 16.948242 C 3.224284 17.120768 3.424479 17.255859 3.652344 17.353516 C 3.880208 17.451172 4.121094 17.5 4.375 17.5 L 9.375 17.5 C 9.576822 17.5 9.76888 17.470703 9.951172 17.412109 C 10.133463 17.353516 10.302734 17.268881 10.458984 17.158203 C 10.615234 17.047525 10.751953 16.915689 10.869141 16.762695 C 10.986328 16.609701 11.077474 16.438803 11.142578 16.25 L 12.441406 16.25 C 12.369791 16.608072 12.237955 16.940104 12.045898 17.246094 C 11.853841 17.552084 11.621094 17.815756 11.347656 18.037109 C 11.074219 18.258463 10.768229 18.432617 10.429688 18.55957 C 10.091146 18.686523 9.739583 18.75 9.375 18.75 Z " />
|
||||||
|
</Button>
|
||||||
|
<TextBlock
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Foreground="{StaticResource DiagnosticIdCopyBrush}"
|
||||||
|
IsTextSelectionEnabled="True"
|
||||||
|
Text="{x:Bind ViewModel.PreferencesService.DiagnosticId}" />
|
||||||
|
</StackPanel>
|
||||||
|
</controls:SettingsCard>
|
||||||
</controls:SettingsExpander.Items>
|
</controls:SettingsExpander.Items>
|
||||||
</controls:SettingsExpander>
|
</controls:SettingsExpander>
|
||||||
|
|
||||||
@@ -148,3 +173,4 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</abstract:AboutPageAbstract>
|
</abstract:AboutPageAbstract>
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
|
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
|
||||||
<DisableRuntimeMarshalling>true</DisableRuntimeMarshalling>
|
<DisableRuntimeMarshalling>true</DisableRuntimeMarshalling>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
|
||||||
<GenerateAppInstallerFile>True</GenerateAppInstallerFile>
|
<GenerateAppInstallerFile>True</GenerateAppInstallerFile>
|
||||||
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
|
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
|
||||||
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
|
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
|
||||||
@@ -90,15 +89,12 @@
|
|||||||
<PackageReference Include="CommunityToolkit.Uwp.Controls.TokenizingTextBox" />
|
<PackageReference Include="CommunityToolkit.Uwp.Controls.TokenizingTextBox" />
|
||||||
<PackageReference Include="CommunityToolkit.Uwp.Extensions" />
|
<PackageReference Include="CommunityToolkit.Uwp.Extensions" />
|
||||||
<PackageReference Include="EmailValidation" />
|
<PackageReference Include="EmailValidation" />
|
||||||
<PackageReference Include="Microsoft.AppCenter.Analytics" />
|
|
||||||
<PackageReference Include="Microsoft.AppCenter.Crashes" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
|
||||||
<PackageReference Include="Microsoft.Identity.Client" />
|
|
||||||
<PackageReference Include="Microsoft.UI.Xaml" />
|
<PackageReference Include="Microsoft.UI.Xaml" />
|
||||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Uwp.Managed" />
|
<PackageReference Include="Microsoft.Xaml.Behaviors.Uwp.Managed" />
|
||||||
<PackageReference Include="Nito.AsyncEx" />
|
<PackageReference Include="Nito.AsyncEx" />
|
||||||
<PackageReference Include="Serilog" />
|
|
||||||
<PackageReference Include="Serilog.Exceptions" />
|
|
||||||
<PackageReference Include="sqlite-net-pcl" />
|
<PackageReference Include="sqlite-net-pcl" />
|
||||||
<PackageReference Include="Win2D.uwp" />
|
<PackageReference Include="Win2D.uwp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -192,6 +192,7 @@ namespace Wino.Server
|
|||||||
AppDomain.CurrentDomain.UnhandledException += ServerCrashed;
|
AppDomain.CurrentDomain.UnhandledException += ServerCrashed;
|
||||||
Application.Current.DispatcherUnhandledException += UIThreadCrash;
|
Application.Current.DispatcherUnhandledException += UIThreadCrash;
|
||||||
TaskScheduler.UnobservedTaskException += TaskCrashed;
|
TaskScheduler.UnobservedTaskException += TaskCrashed;
|
||||||
|
|
||||||
// Ensure proper encodings are available for MimeKit
|
// Ensure proper encodings are available for MimeKit
|
||||||
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
|
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
|
||||||
|
|
||||||
@@ -241,9 +242,9 @@ namespace Wino.Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TaskCrashed(object sender, UnobservedTaskExceptionEventArgs e) => Log.Error(e.Exception, "Task crashed.");
|
private void TaskCrashed(object sender, UnobservedTaskExceptionEventArgs e) => Log.Error(e.Exception, "Server task crashed.");
|
||||||
|
|
||||||
private void UIThreadCrash(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) => Log.Error(e.Exception, "UI thread crashed.");
|
private void UIThreadCrash(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) => Log.Error(e.Exception, "Server UI thread crashed.");
|
||||||
|
|
||||||
private void ServerCrashed(object sender, UnhandledExceptionEventArgs e) => Log.Error((Exception)e.ExceptionObject, "Server crashed.");
|
private void ServerCrashed(object sender, UnhandledExceptionEventArgs e) => Log.Error((Exception)e.ExceptionObject, "Server crashed.");
|
||||||
|
|
||||||
|
|||||||
@@ -9,5 +9,7 @@ namespace Wino.Services
|
|||||||
public string ApplicationDataFolderPath { get; set; }
|
public string ApplicationDataFolderPath { get; set; }
|
||||||
public string PublisherSharedFolderPath { get; set; }
|
public string PublisherSharedFolderPath { get; set; }
|
||||||
public string ApplicationTempFolderPath { get; set; }
|
public string ApplicationTempFolderPath { get; set; }
|
||||||
|
|
||||||
|
public string ApplicationInsightsInstrumentationKey => "a5a07c2f-6e24-4055-bfc9-88e87eef873a";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using Serilog;
|
using Microsoft.ApplicationInsights.Extensibility;
|
||||||
|
using Serilog;
|
||||||
using Serilog.Core;
|
using Serilog.Core;
|
||||||
using Serilog.Exceptions;
|
using Serilog.Exceptions;
|
||||||
using Wino.Core.Domain.Interfaces;
|
using Wino.Core.Domain.Interfaces;
|
||||||
|
using Wino.Services.Misc;
|
||||||
|
|
||||||
namespace Wino.Services
|
namespace Wino.Services
|
||||||
{
|
{
|
||||||
@@ -9,10 +11,15 @@ namespace Wino.Services
|
|||||||
{
|
{
|
||||||
private readonly LoggingLevelSwitch _levelSwitch = new LoggingLevelSwitch();
|
private readonly LoggingLevelSwitch _levelSwitch = new LoggingLevelSwitch();
|
||||||
private readonly IPreferencesService _preferencesService;
|
private readonly IPreferencesService _preferencesService;
|
||||||
|
private readonly IApplicationConfiguration _applicationConfiguration;
|
||||||
|
private readonly TelemetryConfiguration _telemetryConfiguration;
|
||||||
|
|
||||||
public LogInitializer(IPreferencesService preferencesService)
|
public LogInitializer(IPreferencesService preferencesService, IApplicationConfiguration applicationConfiguration)
|
||||||
{
|
{
|
||||||
_preferencesService = preferencesService;
|
_preferencesService = preferencesService;
|
||||||
|
_applicationConfiguration = applicationConfiguration;
|
||||||
|
|
||||||
|
_telemetryConfiguration = new TelemetryConfiguration(applicationConfiguration.ApplicationInsightsInstrumentationKey);
|
||||||
|
|
||||||
RefreshLoggingLevel();
|
RefreshLoggingLevel();
|
||||||
}
|
}
|
||||||
@@ -28,10 +35,13 @@ namespace Wino.Services
|
|||||||
|
|
||||||
public void SetupLogger(string fullLogFilePath)
|
public void SetupLogger(string fullLogFilePath)
|
||||||
{
|
{
|
||||||
|
var insightsTelemetryConverter = new WinoTelemetryConverter(_preferencesService.DiagnosticId);
|
||||||
|
|
||||||
Log.Logger = new LoggerConfiguration()
|
Log.Logger = new LoggerConfiguration()
|
||||||
.MinimumLevel.ControlledBy(_levelSwitch)
|
.MinimumLevel.ControlledBy(_levelSwitch)
|
||||||
.WriteTo.File(fullLogFilePath, retainedFileCountLimit: 3, rollOnFileSizeLimit: true, rollingInterval: RollingInterval.Day)
|
.WriteTo.File(fullLogFilePath, retainedFileCountLimit: 3, rollOnFileSizeLimit: true, rollingInterval: RollingInterval.Day)
|
||||||
.WriteTo.Debug()
|
.WriteTo.Debug()
|
||||||
|
.WriteTo.ApplicationInsights(_telemetryConfiguration, insightsTelemetryConverter, restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Error)
|
||||||
.Enrich.FromLogContext()
|
.Enrich.FromLogContext()
|
||||||
.Enrich.WithExceptionDetails()
|
.Enrich.WithExceptionDetails()
|
||||||
.CreateLogger();
|
.CreateLogger();
|
||||||
|
|||||||
38
Wino.Services/Misc/WinoTelemetryConverter.cs
Normal file
38
Wino.Services/Misc/WinoTelemetryConverter.cs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.ApplicationInsights.Channel;
|
||||||
|
using Microsoft.ApplicationInsights.DataContracts;
|
||||||
|
using Serilog.Events;
|
||||||
|
using Serilog.Sinks.ApplicationInsights.TelemetryConverters;
|
||||||
|
|
||||||
|
namespace Wino.Services.Misc
|
||||||
|
{
|
||||||
|
internal class WinoTelemetryConverter : EventTelemetryConverter
|
||||||
|
{
|
||||||
|
private readonly string _userDiagnosticId;
|
||||||
|
|
||||||
|
public WinoTelemetryConverter(string userDiagnosticId)
|
||||||
|
{
|
||||||
|
_userDiagnosticId = userDiagnosticId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IEnumerable<ITelemetry> Convert(LogEvent logEvent, IFormatProvider formatProvider)
|
||||||
|
{
|
||||||
|
foreach (ITelemetry telemetry in base.Convert(logEvent, formatProvider))
|
||||||
|
{
|
||||||
|
// Assign diagnostic id as user id.
|
||||||
|
telemetry.Context.User.Id = _userDiagnosticId;
|
||||||
|
|
||||||
|
yield return telemetry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ForwardPropertiesToTelemetryProperties(LogEvent logEvent, ISupportProperties telemetryProperties, IFormatProvider formatProvider)
|
||||||
|
{
|
||||||
|
ForwardPropertiesToTelemetryProperties(logEvent, telemetryProperties, formatProvider,
|
||||||
|
includeLogLevel: true,
|
||||||
|
includeRenderedMessage: true,
|
||||||
|
includeMessageTemplate: false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,6 +29,8 @@ namespace Wino.Services
|
|||||||
services.AddTransient<IOutlookThreadingStrategy, OutlookThreadingStrategy>();
|
services.AddTransient<IOutlookThreadingStrategy, OutlookThreadingStrategy>();
|
||||||
services.AddTransient<IGmailThreadingStrategy, GmailThreadingStrategy>();
|
services.AddTransient<IGmailThreadingStrategy, GmailThreadingStrategy>();
|
||||||
services.AddTransient<IImapThreadingStrategy, ImapThreadingStrategy>();
|
services.AddTransient<IImapThreadingStrategy, ImapThreadingStrategy>();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,12 +7,13 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="HtmlAgilityPack" />
|
<PackageReference Include="HtmlAgilityPack" />
|
||||||
<PackageReference Include="Ical.Net" />
|
<PackageReference Include="Ical.Net" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
|
||||||
<PackageReference Include="Serilog" />
|
<PackageReference Include="Serilog" />
|
||||||
<PackageReference Include="Serilog.Sinks.Debug" />
|
<PackageReference Include="Serilog.Sinks.Debug" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" />
|
<PackageReference Include="Serilog.Sinks.File" />
|
||||||
<PackageReference Include="Serilog.Exceptions" />
|
<PackageReference Include="Serilog.Exceptions" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.ApplicationInsights" />
|
||||||
<PackageReference Include="SqlKata" />
|
<PackageReference Include="SqlKata" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -141,6 +141,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
|
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<SDKReference Include="Microsoft.VCLibs, Version=14.0" />
|
||||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" VersionOverride="10.0.22621.3233" PrivateAssets="all" />
|
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" VersionOverride="10.0.22621.3233" PrivateAssets="all" />
|
||||||
<PackageReference Include="System.Private.Uri" />
|
<PackageReference Include="System.Private.Uri" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user