Enhanced stack trace and more.
- Types
- Simplified
Systemtype aliases Nullabletypes- Simplified
ValueTupleswith argument names
- Simplified
- Methods
- Local methods
refreturn type
- Constructors
- Instance constructors
- Static constructors
- Lambdas
- Actions
- Funcs
- Properties
- Getter, setter
- Auto-property backing fields
- Generic arguments
- Parameters
- Names
ref,out,inmodifiersparamscollections- Default values
Tasks- Indexers
Install the package with Nuget.
dotnet add package CoreSharp.EnhancedStackTrace
For file name and line number to appear, the project must be compiled with the pdb files.
This can be done by setting DebugType in your .csproj.
portable: Emit debugging information to .pdb file using cross-platform Portable PDB format.embedded: Emit debugging information into the .dll/.exe itself (.pdb file is not produced) using Portable PDB format.
<Project>
<PropertyGroup>
<DebugType>portable</DebugType>
</PropertyGroup>
</Project>using CoreSharp.EnhancedStackTrace.Extensions;
try
{
throw new Exception();
}
catch (Exception exception)
{
var enhancedStackTrace = exception.GetEnhancedStackTrace();
}using CoreSharp.EnhancedStackTrace.Features.Factory;
public sealed class Processor(IEnhancedStackTraceFactory enhancedStackTraceFactory)
{
private readonly IEnhancedStackTraceFactory _enhancedStackTraceFactory = enhancedStackTraceFactory
public void Process()
{
try
{
throw new Exception();
}
catch (Exception exception)
{
var enhancedStackTrace = _enhancedStackTraceFactory.Create(exception);
}
}
}