A Swiss Army knife for developers.
C# blazorcross-platformcsharpdesktopdesktop-appdesktop-applicationdeveloper-toolsextensiblefluentfluent-designlinuxmacosmicasyntax-highlightingtypescriptwindowswindows-10windows-11winui
Fixed an issue where logs won't open if there's no log at all. (#14)
Etienne Baudouxdaffaa7b34f7
diff --git a/src/dev/impl/DevToys/Core/Logger.cs b/src/dev/impl/DevToys/Core/Logger.csindex ebac7f562..4160bc172 100644--- a/src/dev/impl/DevToys/Core/Logger.cs+++ b/src/dev/impl/DevToys/Core/Logger.cs@@ -19,15 +19,24 @@ namespace DevToys.Coreinternal static async Task OpenLogsAsync(){- StorageFolder localCacheFolder = ApplicationData.Current.LocalCacheFolder;-- IStorageItem file = await localCacheFolder.TryGetItemAsync(LogFileName);- if (file is not null and IStorageFile storageFile)+ using (await _semaphore.WaitAsync(CancellationToken.None)){- await ThreadHelper.RunOnUIThreadAsync(async () =>+ StorageFolder localCacheFolder = ApplicationData.Current.LocalCacheFolder;++ IStorageItem file = await localCacheFolder.TryGetItemAsync(LogFileName);++ if (file is null){- await Launcher.LaunchFileAsync(storageFile);- });+ file = await localCacheFolder.CreateFileAsync(LogFileName, CreationCollisionOption.OpenIfExists);+ }++ if (file is not null and IStorageFile storageFile)+ {+ await ThreadHelper.RunOnUIThreadAsync(async () =>+ {+ await Launcher.LaunchFileAsync(storageFile);+ });+ }}}@@ -67,7 +76,6 @@ namespace DevToys.Core}catch (Exception){-}}}