Skip to content

Commit

Permalink
Address the warnings from build output (#1456)
Browse files Browse the repository at this point in the history
* Address the warnings from build output

* Forgot some tasks

* Update test task
  • Loading branch information
WardenGnaw authored Jun 3, 2024
1 parent 48a9cbe commit 8ce5af7
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 41 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/Build-And-Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
Expand All @@ -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: |
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/DebugEngineHost/HostOutputWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static void Write(string message, string pane = DefaultOutputPane)
}

// Output the text
outputPane.OutputString(message);
outputPane.OutputStringThreadSafe(message);
}
catch (Exception)
{
Expand Down
41 changes: 24 additions & 17 deletions src/MIDebugPackage/MIDebugPackagePackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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?");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/SSHDebugPS/VsOutputWindowWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public static void Write(string message, string pane = DefaultOutputPane)
}

// Output the text
outputPane.OutputString(message);
outputPane.OutputStringThreadSafe(message);
}
catch (Exception)
{
Expand Down
6 changes: 0 additions & 6 deletions test/DebuggerTesting/OpenDebug/RunnerException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

0 comments on commit 8ce5af7

Please sign in to comment.