-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose stack trace metadata stripping as a supported option (#88235)
- Loading branch information
1 parent
779d536
commit f25bc7b
Showing
5 changed files
with
56 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/tests/nativeaot/SmokeTests/StackTraceMetadata/StackTraceMetadata.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Runtime.CompilerServices; | ||
|
||
class Program | ||
{ | ||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
static int Main() | ||
{ | ||
string stackTrace = Environment.StackTrace; | ||
|
||
Console.WriteLine(stackTrace); | ||
|
||
#if STRIPPED | ||
const bool expected = false; | ||
#else | ||
const bool expected = true; | ||
#endif | ||
bool actual = stackTrace.Contains(nameof(Main)) && stackTrace.Contains(nameof(Program)); | ||
return expected == actual ? 100 : 1; | ||
} | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
src/tests/nativeaot/SmokeTests/StackTraceMetadata/StackTraceMetadata.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<CLRTestKind>BuildAndRun</CLRTestKind> | ||
<CLRTestPriority>0</CLRTestPriority> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<InvariantGlobalization>true</InvariantGlobalization> | ||
<CLRTestTargetUnsupported Condition="'$(IlcMultiModule)' == 'true'">true</CLRTestTargetUnsupported> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="StackTraceMetadata.cs" /> | ||
</ItemGroup> | ||
</Project> |
15 changes: 15 additions & 0 deletions
15
src/tests/nativeaot/SmokeTests/StackTraceMetadata/StackTraceMetadata_Stripped.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<CLRTestKind>BuildAndRun</CLRTestKind> | ||
<CLRTestPriority>0</CLRTestPriority> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<InvariantGlobalization>true</InvariantGlobalization> | ||
<CLRTestTargetUnsupported Condition="'$(IlcMultiModule)' == 'true'">true</CLRTestTargetUnsupported> | ||
<DefineConstants>$(DefineConstants);STRIPPED</DefineConstants> | ||
<StackTraceSupport>false</StackTraceSupport> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="StackTraceMetadata.cs" /> | ||
</ItemGroup> | ||
</Project> |