Sunmeat.Lens.Raster 1.0.0

dotnet add package Sunmeat.Lens.Raster --version 1.0.0
                    
NuGet\Install-Package Sunmeat.Lens.Raster -Version 1.0.0
                    
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="Sunmeat.Lens.Raster" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sunmeat.Lens.Raster" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Sunmeat.Lens.Raster" />
                    
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 Sunmeat.Lens.Raster --version 1.0.0
                    
#r "nuget: Sunmeat.Lens.Raster, 1.0.0"
                    
#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 Sunmeat.Lens.Raster@1.0.0
                    
#: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=Sunmeat.Lens.Raster&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Sunmeat.Lens.Raster&version=1.0.0
                    
Install as a Cake Tool

Sunmeat.Lens logo

Sunmeat.Lens

See beyond the code.

Inspect .NET types and assemblies, generate UML, and explore dependencies in an interactive offline report. Lens offers a small reflection core and optional C# analysis with Roslyn.

NuGet CI MIT .NET Support development

Українська

Install

Version 1.0.0 is prepared for release. Use the local build before NuGet.org publication. The optional Roslyn package analyzes C# files, projects and solutions. The Raster package exports PNG and JPEG.

dotnet add package Sunmeat.Lens --version 1.0.0
dotnet add package Sunmeat.Lens.Roslyn --version 1.0.0
dotnet add package Sunmeat.Lens.Raster --version 1.0.0

All three packages target .NET 8, 9, 10 and 11. Compatibility · Build and publish

Quick start

using Sunmeat.Lens;

var type = Lens.Inspect<Person>();
Console.WriteLine(type.ToText());

var person = new Person { Name = "Olena", Age = 29 };
var reader = Lens.Create(new LensOptions { ReadPropertyValues = true });
reader.Inspect(person).SaveJson("person.json");
Lens.Uml<Person>().WithTheme(LensTheme.Blueprint).Save("person.svg");

public sealed class Person
{
    public string Name { get; init; } = "";
    public int Age { get; init; }
}

Type inspection reads declared members, generic constraints and attribute data. Structural object inspection reads instance fields and bounded standard collections. Opt in to getters for values from trusted objects.

Explore an assembly

using Sunmeat.Lens;

var assembly = Lens.AnalyzeAssembly(typeof(LensOptions).Assembly.Location);
assembly.ToClassDiagram(UmlOptions.Minimal).Save("classes.svg");
assembly.PublicApi().Save("api.json");

The PE reader extracts assembly identities, references, resources, member signatures and public API. It reads the target as a file and reports external references by identity.

Analyze C# and architecture

using Sunmeat.Lens;
using Sunmeat.Lens.Roslyn;

var model = LensSource.AnalyzeSource("""
    namespace Contracts { public interface IClock { int Tick(); } }
    namespace App { public record Consumer(Contracts.IClock Clock); }
    """);

model.SaveHtml("architecture.html", LensLanguage.Ukrainian);
model.SaveMarkdown("types.md");

var rules = new LensRules().ForbidDependency("Contracts", "App").RequireAcyclicNamespaces();
Console.WriteLine(rules.Evaluate(model).Passed);

var rubric = new LensCurriculum(new("interfaces"), new("execution"));
rubric.Evaluate(model).SaveHtml("review.html", LensLanguage.Ukrainian);

The Roslyn module reads source, conventional SDK projects and .sln or .slnx solutions. It records compiler diagnostics, locations, resolved calls and source metrics. Project analysis reads XML declarations without running MSBuild.

Diagrams and reports

Generate class, object, namespace and explicitly mapped component diagrams. Export SVG, PlantUML, Mermaid, DOT, JSON, Markdown, HTML, GraphML or DGML. Choose from 14 SVG palettes or supply your own colors.

UML class diagram generated by Lens

The English and Ukrainian architecture reports support type search, namespace filters, selection, relationship navigation, zoom and a light or dark interface.

Offline architecture report with selected type

High-resolution UML from C# and project generation from JSON

Generate UML class diagrams from C# files and save them as lossless PNG, high-quality JPEG or JSON. Raster output uses the same geometry, themes and wrapped member signatures as SVG. The default scale is 3× and the default JPEG quality is 96 out of 100.

Create a new C# project from a .lens.json file. The versioned format accepts full source text and structured class presets. Generation creates a .csproj and its .cs files in a new directory. classes.diagram.json contains nodes and relationships for visualization.

using Sunmeat.Lens;
using Sunmeat.Lens.Raster;
using Sunmeat.Lens.Roslyn;

var input = Directory.CreateTempSubdirectory("lens-csharp-");
var file = Path.Combine(input.FullName, "Orders.cs");
File.WriteAllText(file, """
    public interface IOrder { string Number { get; } }
    public sealed record Order(string Number) : IOrder;
    """);

var blueprint = LensProjectBlueprint.FromFiles("Orders", [file]);
var diagram = blueprint.Analyze().ToClassDiagram(new UmlOptions { Theme = LensTheme.Blueprint });
diagram.SavePng("classes.png", new LensRasterOptions { Scale = 4 });
diagram.SaveJpeg("classes.jpg", new LensRasterOptions { Scale = 4, JpegQuality = 97 });
diagram.Save("classes.diagram.json");

blueprint.SaveJson("project.lens.json");
var project = LensProjectBlueprint.LoadJson("project.lens.json").GenerateProject("RecreatedOrders");
Console.WriteLine(project);

JSON schema · Ready-to-use preset · API and examples

Rules, compatibility and learning

Check namespace boundaries and cycles. Review evidence for large interfaces, namespace coupling, Strategy and Factory Method candidates. Compare public API snapshots for structural changes, review code metrics, and evaluate a configurable rubric without running the analyzed application.

Playground and documentation

dotnet run -c Release --project examples/LensPlayground -- --demo artifacts/demo

Run without arguments to inspect your own assemblies and projects in the interactive console sample.

API and formats · Input limits and privacy · Tool comparison · Benchmarks · Roadmap

Sunmeat ecosystem

Library Purpose
Sunmeat.Prism Serialization
Sunmeat.Pulse Logging
Sunmeat.Guard Validation
Sunmeat.Diff Data comparison and patches
Sunmeat.Morph Object mapping
Sunmeat.Forge Synthetic test data
Sunmeat.Lens Code inspection and architecture

❤️ Support the project

Sunmeat.Lens is free and open source. Voluntary support helps maintain the library, documentation and examples.

Support development Patreon Monobank

License

MIT. Copyright © 2026 Oleksandr Zahoruiko · sunmeat.dev.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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.  net11.0 is compatible. 
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.0.0 61 11/30/2026

Initial release with type and object inspection, safe assembly and C# analysis, UML, architecture checks and offline reports.