@@ -68,18 +68,28 @@ internal class FakeTransport : ITransport
6868 }
6969 }
7070
71+ function publishConsoleApp ([bool ]$SentryNative = $true )
72+ {
73+ dotnet publish console- app `
74+ - c Release `
75+ -- nologo `
76+ -- framework $framework `
77+ - p:SentryNative= $ ($SentryNative.ToString ().ToLower()) `
78+ | ForEach-Object { Write-Host $_ }
79+ if ($LASTEXITCODE -ne 0 )
80+ {
81+ throw ' Failed to publish the test app project.'
82+ }
83+ }
84+
7185 function runConsoleApp ([
bool ]
$IsAOT = $true , [
string ]
$CrashType = ' Managed' , [
string ]
$Dsn = ' http://[email protected] :9999/123' )
7286 {
7387 if ($IsAOT )
7488 {
7589 $executable = getConsoleAppPath
7690 If (! (Test-Path $executable ))
7791 {
78- dotnet publish console- app - c Release -- nologo -- framework $framework | ForEach-Object { Write-Host $_ }
79- if ($LASTEXITCODE -ne 0 )
80- {
81- throw ' Failed to publish the test app project.'
82- }
92+ publishConsoleApp
8393 }
8494 }
8595 else
@@ -90,7 +100,7 @@ internal class FakeTransport : ITransport
90100 Write-Host " ::group::Executing $executable "
91101 try
92102 {
93- Invoke-Expression $executable | ForEach-Object {
103+ Invoke-Expression " $executable 2>&1 " | ForEach-Object {
94104 Write-Host " $_ "
95105 $_
96106 }
@@ -120,8 +130,19 @@ internal class FakeTransport : ITransport
120130 " console-app$exeExtension " , " console-app$debugExtension " ) | Sort-Object - Unique)
121131 }
122132
123- It " 'dotnet publish' produces an app that's recognized as AOT by Sentry" {
124- runConsoleApp | Should - AnyElementMatch ' This looks like a Native AOT application build.'
133+ It " 'dotnet publish' produces an app that's recognized as AOT by Sentry (SentryNative=<_>)" - ForEach @ ($false , $true ) {
134+ publishConsoleApp $_
135+ $output = runConsoleApp
136+ $output | Should - AnyElementMatch ' This looks like a Native AOT application build.'
137+ $output | Should -Not - AnyElementMatch ' System.DllNotFoundException: Unable to load (shared library|DLL) '' sentry-native'' or one of its dependencies'
138+ if ($_ )
139+ {
140+ $output | Should - AnyElementMatch ' Initializing sentry native'
141+ }
142+ else
143+ {
144+ $output | Should -Not - AnyElementMatch ' Initializing sentry native'
145+ }
125146 }
126147
127148 It " 'dotnet run' produces an app that's recognized as JIT by Sentry" {
0 commit comments