Skip to content

efthymios-ks/CoreSharp.EnhancedStackTrace

Repository files navigation

CoreSharp.EnhancedStackTrace

Nuget Coverage Quality Gate Status GitHub License

Enhanced stack trace and more.

Features

Handles

  • Types
    • Simplified System type aliases
    • Nullable types
    • Simplified ValueTuples with argument names
  • Methods
    • Local methods
    • ref return type
  • Constructors
    • Instance constructors
    • Static constructors
  • Lambdas
    • Actions
    • Funcs
  • Properties
    • Getter, setter
    • Auto-property backing fields
  • Generic arguments
  • Parameters
    • Names
    • ref, out, in modifiers
    • params collections
    • Default values
  • Tasks
  • Indexers

Installation

Install the package with Nuget.

dotnet add package CoreSharp.EnhancedStackTrace

Documentation

File & line info

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>

Use cases

Extensions

using CoreSharp.EnhancedStackTrace.Extensions; 

try
{
	throw new Exception();
}
catch (Exception exception)
{
	var enhancedStackTrace = exception.GetEnhancedStackTrace(); 
}

Dependency Injection

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); 
		}
	}
}

About

No description, website, or topics provided.

Resources

License

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages