diff --git a/.github/workflows/Build-And-Test.yml b/.github/workflows/Build-And-Test.yml index 39e9e12c5..9fe5827ac 100644 --- a/.github/workflows/Build-And-Test.yml +++ b/.github/workflows/Build-And-Test.yml @@ -22,20 +22,20 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install .NET Core - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x - name: Setup MSBuild.exe - uses: microsoft/setup-msbuild@v1.1 + uses: microsoft/setup-msbuild@v2 - name: Setup NuGet.exe for use with actions - uses: NuGet/setup-nuget@v1 + uses: NuGet/setup-nuget@v2 - name: Build MIDebugEngine run: | @@ -44,7 +44,7 @@ jobs: Configuration: ${{ matrix.configuration }} - name: Setup VSTest.console.exe - uses: darenm/Setup-VSTest@v1.2 + uses: darenm/Setup-VSTest@v1.3 - name: Run VS Extension tests run: vstest.console.exe ${{ github.workspace }}\bin\${{ matrix.configuration }}\MICoreUnitTests.dll ${{ github.workspace }}\bin\${{ matrix.configuration }}\JDbgUnitTests.dll ${{ github.workspace }}\bin\${{ matrix.configuration }}\SSHDebugTests.dll ${{ github.workspace }}\bin\${{ matrix.configuration }}\MIDebugEngineUnitTests.dll @@ -54,20 +54,20 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install .NET Core - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x - name: Setup MSBuild.exe - uses: microsoft/setup-msbuild@v1.1 + uses: microsoft/setup-msbuild@v2 - name: Setup NuGet.exe for use with actions - uses: NuGet/setup-nuget@v1 + uses: NuGet/setup-nuget@v2 - name: Build MIDebugEngine run: | @@ -102,7 +102,7 @@ jobs: dotnet test $CppTestsPath --logger "trx;LogFileName=$ResultsPath" - name: 'Upload Test Results' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ always() }} with: name: win_msys2_x64_results @@ -112,12 +112,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install .NET Core - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x @@ -143,7 +143,7 @@ jobs: ${{ github.workspace }}/eng/Scripts/CI-Test.sh - name: 'Upload Test Results' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ always() }} with: name: linux_x64_results @@ -153,12 +153,12 @@ jobs: runs-on: macos-12 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install .NET Core - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x @@ -172,7 +172,7 @@ jobs: ${{ github.workspace }}/eng/Scripts/CI-Test.sh - name: 'Upload Test Results' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ always() }} with: name: osx_x64_results diff --git a/src/DebugEngineHost/HostOutputWindow.cs b/src/DebugEngineHost/HostOutputWindow.cs index 1d2b63632..9dec6445a 100644 --- a/src/DebugEngineHost/HostOutputWindow.cs +++ b/src/DebugEngineHost/HostOutputWindow.cs @@ -117,7 +117,7 @@ public static void Write(string message, string pane = DefaultOutputPane) } // Output the text - outputPane.OutputString(message); + outputPane.OutputStringThreadSafe(message); } catch (Exception) { diff --git a/src/MIDebugPackage/MIDebugPackagePackage.cs b/src/MIDebugPackage/MIDebugPackagePackage.cs index be94cc4cd..1820a382a 100644 --- a/src/MIDebugPackage/MIDebugPackagePackage.cs +++ b/src/MIDebugPackage/MIDebugPackagePackage.cs @@ -405,29 +405,36 @@ private void EnableLogging(bool sendToOutputWindow, string logFile) ThreadHelper.ThrowIfNotOnUIThread(); IVsDebugger debugger = (IVsDebugger)GetService(typeof(IVsDebugger)); - DBGMODE[] mode = new DBGMODE[] { DBGMODE.DBGMODE_Design }; - int hr = debugger.GetMode(mode); - - if (hr == VSConstants.S_OK && mode[0] != DBGMODE.DBGMODE_Design) + if (debugger != null) { - throw new ArgumentException("Unable to update MIDebugLog while debugging."); - } + DBGMODE[] mode = new DBGMODE[] { DBGMODE.DBGMODE_Design }; + int hr = debugger.GetMode(mode); - try - { - MIDebugCommandDispatcher.EnableLogging(sendToOutputWindow, logFile); - } - catch (Exception e) - { - var commandWindow = (IVsCommandWindow)GetService(typeof(SVsCommandWindow)); - if (commandWindow != null) + if (hr == VSConstants.S_OK && mode[0] != DBGMODE.DBGMODE_Design) { - commandWindow.Print(string.Format(CultureInfo.CurrentCulture, "Error: {0}\r\n", e.Message)); + throw new ArgumentException("Unable to update MIDebugLog while debugging."); } - else + + try { - throw new InvalidOperationException("Why is IVsCommandWindow null?"); + MIDebugCommandDispatcher.EnableLogging(sendToOutputWindow, logFile); } + catch (Exception e) + { + var commandWindow = (IVsCommandWindow)GetService(typeof(SVsCommandWindow)); + if (commandWindow != null) + { + commandWindow.Print(string.Format(CultureInfo.CurrentCulture, "Error: {0}\r\n", e.Message)); + } + else + { + throw new InvalidOperationException("Why is IVsCommandWindow null?"); + } + } + } + else + { + throw new InvalidOperationException("Why is IVsDebugger null?"); } } diff --git a/src/SSHDebugPS/VsOutputWindowWrapper.cs b/src/SSHDebugPS/VsOutputWindowWrapper.cs index 5e4d7527e..1076f6eb5 100644 --- a/src/SSHDebugPS/VsOutputWindowWrapper.cs +++ b/src/SSHDebugPS/VsOutputWindowWrapper.cs @@ -118,7 +118,7 @@ public static void Write(string message, string pane = DefaultOutputPane) } // Output the text - outputPane.OutputString(message); + outputPane.OutputStringThreadSafe(message); } catch (Exception) { diff --git a/test/DebuggerTesting/OpenDebug/RunnerException.cs b/test/DebuggerTesting/OpenDebug/RunnerException.cs index 31fa5536c..c085c865d 100644 --- a/test/DebuggerTesting/OpenDebug/RunnerException.cs +++ b/test/DebuggerTesting/OpenDebug/RunnerException.cs @@ -32,11 +32,5 @@ public RunnerException(string message, Exception innerException) public RunnerException(Exception innerException, string messageFormat, params object[] messageArgs) : base(string.Format(CultureInfo.CurrentCulture, messageFormat, messageArgs), innerException) { } - -#if !CORECLR - // Required for serialization - protected RunnerException(SerializationInfo info, StreamingContext context) - : base(info, context) { } -#endif } }