Beskar.Memory.Code 1.5.9

There is a newer version of this package available.
See the version list below for details.
dotnet add package Beskar.Memory.Code --version 1.5.9
                    
NuGet\Install-Package Beskar.Memory.Code -Version 1.5.9
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Beskar.Memory.Code" Version="1.5.9" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Beskar.Memory.Code" Version="1.5.9" />
                    
Directory.Packages.props
<PackageReference Include="Beskar.Memory.Code" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Beskar.Memory.Code --version 1.5.9
                    
#r "nuget: Beskar.Memory.Code, 1.5.9"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Beskar.Memory.Code@1.5.9
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Beskar.Memory.Code&version=1.5.9
                    
Install as a Cake Addin
#tool nuget:?package=Beskar.Memory.Code&version=1.5.9
                    
Install as a Cake Tool

Beskar.Memory.Code

NuGet Version

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 struct writer designed specifically for code generation.
    • Key Feature: Integrates automatic, custom-configurable indentation levels and interpolated string formatting with zero heap allocations.
  • CodeRenderer
    • Description: A simple abstract base class providing standardized, cancellation-aware C# source file creation using Roslyn's SourceProductionContext.
  • CodeWriterExtensions
    • Description: An extension block on ref CodeTextWriter providing fast formatting templates like WriteEnableNullable, WriteUsing, WriteNamespace, and auto-generated header blocks.
  • 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.
  • 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 AttributeData to cleanly extract named arguments (numbers, booleans, enums, arrays, and types) without memory allocations.
  • 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 SnakeCase or FirstCharToLower) backed by SpanOwner<char>.
  • AccessibilityExtensions
    • Description: Maps C# Accessibility to standard keyword string signatures (public, private, etc.).
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.6.2 37 5/30/2026
1.6.1 44 5/29/2026
1.6.0 40 5/29/2026
1.5.9 37 5/29/2026
1.5.8 57 5/28/2026
1.5.7 48 5/28/2026
1.5.6 43 5/28/2026
1.5.5 41 5/28/2026
1.5.4 41 5/28/2026
1.5.3 43 5/28/2026
1.5.2 45 5/28/2026
1.5.1 40 5/26/2026
1.5.0 36 5/26/2026