Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build.yml to test including process dumps #201

Closed
wants to merge 11 commits into from
Closed
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
]
},
"microsoft.visualstudio.slngen.tool": {
"version": "11.2.3",
"version": "11.2.6",
"commands": [
"slngen"
]
}
}
}
}
57 changes: 54 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

env:
DOTNET_VERSION: ${{ '8.0.x' }}
ENABLE_DIAGNOSTICS: false
ENABLE_DIAGNOSTICS: true
#COREHOST_TRACE: 1
COREHOST_TRACEFILE: corehosttrace.log

Expand Down Expand Up @@ -130,7 +130,7 @@ jobs:

- name: Add project heads to ProjectTemplate
working-directory: ./${{ env.PROJECT_DIRECTORY }}
run: ${{ github.workspace }}/${{ env.HEADS_DIRECTORY }}/GenerateSingleSampleHeads.ps1 -componentPath ${{ github.workspace }}/${{ env.PROJECT_DIRECTORY }}${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}
run: ${{ github.workspace }}/${{ env.HEADS_DIRECTORY }}/GenerateSingleSampleHeads.ps1 -componentPath ${{ github.workspace }}/${{ env.PROJECT_DIRECTORY }}

# Build and use template for creating new experiments
- name: Build ProjectTemplate
Expand All @@ -153,6 +153,50 @@ jobs:
minimum-size: 32GB
maximum-size: 32GB
disk-root: "C:"

- name: Enable Crash Dumps
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
shell: pwsh
run: |
# If we set the registry from a 32-bit process on a 64-bit machine, we will set the "virtualized" syswow registry.
# For crash dump collection we always want to set the "native" registry, so we make sure to invoke the native cmd.exe
$nativeCmdPath = "$env:SystemRoot\system32\cmd.exe"
if([Environment]::Is64BitOperatingSystem -and ![Environment]::Is64BitProcess)
{
# The "sysnative" path is a 'magic' path that allows a 32-bit process to invoke the native 64-bit cmd.exe.
$nativeCmdPath = "$env:SystemRoot\sysnative\cmd.exe"
}

if(!$dumpFolder)
{
$dumpFolder = "C:\dumps"
}

function Enable-CrashDumpsForProcesses {
Param([string[]]$namesOfProcessesForDumpCollection)

foreach($procName in $namesOfProcessesForDumpCollection )
{
Write-Host "Enabling local crash dumps for $procName"
& $nativeCmdPath /c reg add "HKLM\Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\$procName" /v DumpFolder /t REG_EXPAND_SZ /d $dumpFolder /f
& $nativeCmdPath /c reg add "HKLM\Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\$procName" /v DumpType /t REG_DWORD /d 2 /f
& $nativeCmdPath /c reg add "HKLM\Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\$procName" /v DumpCount /t REG_DWORD /d 3 /f
}
}

# enable dump collection for our test apps:
$namesOfProcessesForDumpCollection = @(
"CommunityToolkit.Tests.Uwp.exe",
"CommunityToolkit.Tests.WinAppSdk.exe",
"CiTestExp.Tests.Uwp.exe",
"CiTestExp.Tests.WinAppSdk.exe",
"Labs.CiTestExp.Tests.Uwp.exe",
"Labs.CiTestExp.Tests.AppSdk.exe",
"Labs.CiTestExp.Tests.Uwp_1.0.0.0_x64__1v6rh0sdhj24c.exe",
"Labs.CiTestExp.Tests.AppSdk_1.0.0.0_x64__1v6rh0sdhj24c.exe",
"VSTest.Console.exe")

Enable-CrashDumpsForProcesses $namesOfProcessesForDumpCollection

- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
uses: actions/setup-dotnet@v4
Expand Down Expand Up @@ -200,7 +244,7 @@ jobs:

- name: Add project heads to ${{ env.TEST_PROJECT_NAME }}
working-directory: ./${{ env.TEST_PROJECT_DIRECTORY }}
run: ${{ github.workspace }}/${{ env.HEADS_DIRECTORY }}/GenerateSingleSampleHeads.ps1 -componentPath ${{ github.workspace }}/${{ env.TEST_PROJECT_DIRECTORY }}${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}
run: ${{ github.workspace }}/${{ env.HEADS_DIRECTORY }}/GenerateSingleSampleHeads.ps1 -componentPath ${{ github.workspace }}/${{ env.TEST_PROJECT_DIRECTORY }}

- name: MSBuild
working-directory: ./${{ env.TEST_PROJECT_DIRECTORY }}
Expand Down Expand Up @@ -235,6 +279,13 @@ jobs:
name: new-experiment-logs
path: ./**/*.*log

- name: Artifact - Process Dumps
uses: actions/upload-artifact@v4
if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }}
with:
name: new-experiment-dumps
path: C:/dumps/*.*dmp

wasm-linux:
runs-on: ubuntu-latest
env:
Expand Down
5 changes: 4 additions & 1 deletion MultiTarget/PackageReferences/WinAppSdk.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<Project>
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240311000" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240531000-experimental1" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.1.0-prerelease.240722.1" PrivateAssets="all" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion MultiTarget/WinUI.Extra.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) >= 8">win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="8 > $([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)'))">win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<WindowsSdkPackageVersion>10.0.22621.37-preview</WindowsSdkPackageVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(IsUno)' == 'true'">
Expand Down
5 changes: 3 additions & 2 deletions ProjectHeads/Head.WinAppSdk.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
<Import Project="$(MSBuildThisFileDirectory)\..\MultiTarget\WinUI.Extra.props" />

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<!-- Set to true when WinAppSdk releases AoT support in 1.6+ -->
<PublishAot>false</PublishAot>
<PublishAot>true</PublishAot>
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) >= 8">win-$(Platform)</RuntimeIdentifier>
<RuntimeIdentifier Condition="8 > $([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)'))">win10-$(Platform)</RuntimeIdentifier>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading