Skip to content
Closed
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
33 changes: 33 additions & 0 deletions src/Http/Http.Extensions/test/JsonOptionsTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Runtime.InteropServices;
using System.Text.Json.Serialization.Metadata;
using Microsoft.AspNetCore.Http.Json;
using Microsoft.AspNetCore.InternalTesting;
Expand All @@ -14,6 +15,38 @@ public class JsonOptionsTests
[RemoteExecutionSupported]
public void DefaultSerializerOptions_SetsTypeInfoResolverEmptyResolver_WhenJsonIsReflectionEnabledByDefaultFalse()
{
// Diagnostic: log native libraries and threads in the testhost process
// to help diagnose intermittent ECHILD FailFast (dotnet/runtime#33297)
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
try
{
Console.WriteLine("=== DIAGNOSTIC: /proc/self/maps (native libraries) ===");
foreach (var line in File.ReadLines("/proc/self/maps"))
{
// Only log lines with .so files to reduce noise
if (line.Contains(".so"))
{
Console.WriteLine(line);
}
}
Console.WriteLine("=== DIAGNOSTIC: /proc/self/status ===");
Console.WriteLine(File.ReadAllText("/proc/self/status"));
Console.WriteLine("=== DIAGNOSTIC: threads ===");
foreach (var dir in Directory.GetDirectories("/proc/self/task"))
{
var tid = Path.GetFileName(dir);
var comm = File.ReadAllText(Path.Combine(dir, "comm")).Trim();
Console.WriteLine($" tid={tid} comm={comm}");
}
Console.WriteLine("=== END DIAGNOSTIC ===");
}
catch (Exception ex)
{
Console.WriteLine($"Diagnostic failed: {ex.Message}");
}
}

var options = new RemoteInvokeOptions();
options.RuntimeConfigurationOptions.Add("System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault", false.ToString());

Expand Down
Loading