Beskar.Memory.Code
1.6.2
dotnet add package Beskar.Memory.Code --version 1.6.2
NuGet\Install-Package Beskar.Memory.Code -Version 1.6.2
<PackageReference Include="Beskar.Memory.Code" Version="1.6.2" />
<PackageVersion Include="Beskar.Memory.Code" Version="1.6.2" />
<PackageReference Include="Beskar.Memory.Code" />
paket add Beskar.Memory.Code --version 1.6.2
#r "nuget: Beskar.Memory.Code, 1.6.2"
#:package Beskar.Memory.Code@1.6.2
#addin nuget:?package=Beskar.Memory.Code&version=1.6.2
#tool nuget:?package=Beskar.Memory.Code&version=1.6.2
Beskar.Memory.Code
A high-performance utility library designed for Roslyn Source Generators. It provides low-allocation abstractions to analyze compiler symbols, build diagnostic maps, and generate code cleanly and rapidly. It replaces standard heavy LINQ-based symbol operations with low-allocation structures backed by Beskar.Memory.
Core Component Directory
1. Code Rendering & Formatting
CodeTextWriter- Description: A high-performance, stack-only
ref structwriter designed specifically for code generation. - Key Feature: Integrates automatic, custom-configurable indentation levels and interpolated string formatting with zero heap allocations.
- Description: A high-performance, stack-only
CodeRenderer- Description: A simple abstract base class providing standardized, cancellation-aware C# source file creation using Roslyn's
SourceProductionContext.
- Description: A simple abstract base class providing standardized, cancellation-aware C# source file creation using Roslyn's
CodeWriterExtensions- Description: An extension block on
ref CodeTextWriterproviding fast formatting templates likeWriteEnableNullable,WriteUsing,WriteNamespace, and auto-generated header blocks.
- Description: An extension block on
SymbolDisplayFormats- Description: A collection of static Roslyn display format templates used to generate clean type, member, and property signature strings.
2. Diagnostics Management
DiagnosticBuilder<T>- Description: A high-performance, low-allocation builder designed to accumulate, format, and dispatch compiler diagnostics.
- Key Feature: Backed by
ArrayBuilder<T>to completely eliminate garbage collection overhead in compiler analysis hot paths.
DiagnosticSpec- Description: A readonly record representing a specific diagnostic code and its parameters.
MaybeSpec<T>- Description: A union spec representing the optional successfully compiled code generator value alongside accumulated compiler diagnostics.
3. Roslyn Symbol Specifications (Specs)
Lightweight specification records that serialize compiler symbols into easily matching models:
SymbolSpec- Description: The base record holding name, accessibility, and flag indicators for any compiler symbol.
TypeSymbolSpec- Description: A specification detail representing unmanaged or managed compiler types.
NamedTypeSymbolSpec- Description: Representing classes, records, and interfaces with nested specifications.
FieldSymbolSpec- Description: Specification maps for class fields and constants.
PropertySymbolSpec- Description: Representing properties including custom get/set configurations.
MethodSymbolSpec- Description: Model representing void returns, parameters, attributes, and asynchronous/iterator states.
ParameterSymbolSpec- Description: Parameter specifications mapped inside method signatures.
TypeParameterSymbolSpec- Description: Generic type constraints and parameters.
4. Roslyn Metadata Archetypes
Compact metadata models used to generate raw symbol signatures during code rendering:
TypeSymbolArchetype/NamedTypeSymbolArchetype/FieldSymbolArchetype/PropertySymbolArchetype/MethodSymbolArchetype/ParameterSymbolArchetype/TypeParameterArchetype- Description: A clean hierarchy of lightweight, highly-cached symbol description structures.
5. transformers & Translators
SymbolSpecTransformer/TypeSymbolSpecTransformer/NamedTypeSymbolSpecTransformer/FieldSymbolSpecTransformer/PropertySymbolSpecTransformer/MethodSymbolSpecTransformer/ParameterSymbolSpecTransformer/TypeParameterSymbolSpecTransformer- Description: Systemic translation helpers that compile active Roslyn compiler symbols (
ISymbol,IMethodSymbol, etc.) into specification specs under custom filters.
- Description: Systemic translation helpers that compile active Roslyn compiler symbols (
TypeSymbolArchetypeTransformer/NamedTypeSymbolArchetypeTransformer/FieldSymbolArchetypeTransformer/PropertySymbolArchetypeTransformer/MethodSymbolArchetypeTransformer/ParameterSymbolArchetypeTransformer/TypeParameterSymbolArchetypeTransformer- Description: Transformers converting active symbols into their lightweight description archetypes.
6. Extensions
AttributeDataExtensions- Description: Provides high-performance extension members on Roslyn's
AttributeDatato cleanly extract named arguments (numbers, booleans, enums, arrays, and types) without memory allocations.
- Description: Provides high-performance extension members on Roslyn's
AttributeDataConstructorExtensions- Description: Helpers to extract positional arguments from attribute constructor calls.
AttributeDataFallbackExtensions- Description: Fallback value wrappers for named arguments.
SourceProductionContextExtensions- Description: Dispatches diagnostic lists to Roslyn contexts utilizing zero-allocation arrays.
TypedConstantExtensions/TypedConstantArrayExtensions- Description: Extensions to parse TypedConstant values and arrays efficiently.
SymbolExtensions/TypeSymbolExtensions/NamedTypeSymbolExtensions/FieldSymbolExtensions/PropertySymbolExtensions/MethodSymbolExtensions/ParameterSymbolExtensions/TypeParameterSymbolExtensions- Description: Low-allocation shortcut helpers for typical symbol operations.
StringExtensions- Description: Performs high-performance casing transitions (such as
SnakeCaseorFirstCharToLower) backed bySpanOwner<char>.
- Description: Performs high-performance casing transitions (such as
AccessibilityExtensions- Description: Maps C# Accessibility to standard keyword string signatures (
public,private, etc.).
- Description: Maps C# Accessibility to standard keyword string signatures (
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Beskar.Memory (>= 1.6.2)
- Microsoft.CodeAnalysis.Common (>= 5.3.0)
- Microsoft.CodeAnalysis.CSharp (>= 5.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.