using System.Diagnostics;
using System.Runtime.CompilerServices;
// Deliberately outside any namespace, which makes Type.Namespace null.
public class NoNamespaceHelper
{
///
/// Captures a stack trace whose innermost frame belongs to a type with no namespace.
///
// NoInlining throughout: an inlined frame vanishes from the stack trace, taking the null namespace with it.
[MethodImpl(MethodImplOptions.NoInlining)]
public static StackTrace CaptureStackTrace()
{
return new StackTrace(true);
}
///
/// Routes BuildMessages.AutobuildTestMessage through a call site with no namespace.
///
[MethodImpl(MethodImplOptions.NoInlining)]
public static string AutobuildTestMessage(string message)
{
return UnitTestSharp.BuildMessages.AutobuildTestMessage(message, pedigree: null, error: true);
}
}