Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,44 +18,55 @@ public static int Main()

public void RunTest()
{
CreateAndThrow();
CreateAndThrow();
}

public void CreateAndThrow()
{
string currStack;
string currStack;

try
{
throw new Exception();
throw new Exception();
}
catch(Exception e)
{
currStack = e.StackTrace;
}
catch(Exception e)
{
currStack = e.StackTrace;
}


try
{
{
Guid[] g = new Guid[Int32.MaxValue];
}
catch(OutOfMemoryException e)
{
retVal = 100;

Console.WriteLine("Caught OOM");

if(e.StackTrace.ToString().Substring(0, e.StackTrace.Length - 8) != currStack.Substring(0, currStack.Length - 8))
{
Console.WriteLine("Actual Exception Stack Trace:");
Console.WriteLine("Caught OOM");

string oomStack = e.StackTrace;
string expectedStack = currStack;

if (oomStack.IndexOf(':') != -1)
{
oomStack = oomStack.Substring(0, oomStack.IndexOf(':') - 1);
}

if (expectedStack.IndexOf(':') != -1)
{
expectedStack = expectedStack.Substring(0, expectedStack.IndexOf(':') - 1);
}

if (oomStack != expectedStack)
{
Console.WriteLine("Actual Exception Stack Trace:");
Console.WriteLine(e.StackTrace);
Console.WriteLine();
Console.WriteLine("Expected Stack Trace:");
Console.WriteLine(currStack.ToString());
Console.WriteLine("Expected Stack Trace:");
Console.WriteLine(currStack.ToString());
retVal = 50;
}
}

}

}

3 changes: 0 additions & 3 deletions src/tests/issues.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
<Project DefaultTargets = "GetListOfTestCmds" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- All OS/Arch/Runtime excludes -->
<ItemGroup Condition="'$(XunitTestBinBase)' != ''">
<ExcludeList Include="$(XunitTestBinBase)/baseservices/exceptions/sharedexceptions/emptystacktrace/OOMException01/*">
<Issue>https://github.com/dotnet/runtime/issues/51209</Issue>
</ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)/readytorun/DynamicMethodGCStress/DynamicMethodGCStress/*">
<Issue>timeout</Issue>
</ExcludeList>
Expand Down