r/dotnet • • 27m ago

Article I built an in-process latency/cost profiler for .NET AI apps — here is the segment model and what it cannot measure

2 Upvotes

I maintain Runesvaner, a small Apache-2.0 .NET library that records AI requests as a latency waterfall plus a cost ledger. It is not a gateway and not a replacement for OpenTelemetry; it is an in-process decorator for IChatClient, Semantic Kernel, and VectorData.

The motivation was simple: a RAG endpoint took eight seconds, the LLM span was "slow", and none of the existing tooling told me whether the time was in DNS/TLS, upload, provider queueing, the first token, or streaming.

The measurement model splits a call into:

  • Queue — middleware/serialization before HTTP
  • Connect — DNS + TCP via ConnectCallback
  • Upload — request body serialization
  • ProviderQueue — wait for response headers
  • TTFT — first non-empty text delta
  • Generation — response stream until EOF

Two honesty notes:

  1. TLS has no public completion hook in .NET. I offer an opt-in probe that derives it from certificate validation and marks it Estimated=true/Derived. It is off by default.
  2. Inter-token latency is derived from text chunks, not provider tokens, and is marked ItlEstimated=true. Tokens/s is null without usage.

Cost is versioned and deliberately conservative. The built-in snapshot only includes prices whose source could be retrieved. OpenAI first-party pricing pages returned 403 at snapshot time, so those models resolve to Unknown, not zero. Sample prices are labeled illustrative.

Current state: 100 tests, 10 NuGet packages at 0.3.0-alpha.1 (preview being prepared), Windows/Linux CI, and Windows/Linux Native AOT smoke. Studio can browse a 10k-record JSONL set with a ~0.84 s cold first screen. SQLite AOT is still a known risk, so the AOT path uses JSONL.

Known gaps: budget alerts currently fire as events/callbacks but are not persisted to Studio; the Semantic Kernel adapter does not record token usage because SK Abstractions 1.82 has no unified usage type; tail sampling weights cost totals but not request counts.

Links:

I would like feedback from people running AI workloads in .NET: how do you currently separate provider queueing from your own upload/serialization time? And would a segment-level waterfall be useful in your incident reviews?


r/dotnet • • 2h ago

Promotion Sharp cli

Post image
0 Upvotes

Want to learn how a C# compiler works? sharp CLI is 19k C# lines vs 722k in the MSBuild repo. The whole sharp SDK is just one Native AOT executable: no installed SDK or MSBuild needed. Compiling our own code results in these timings: dotnet build 4.2s, sharp build 2.0s.


r/dotnet • • 4h ago

🔥 If You Had to Build a Windows Forms App That Users Would Actually WANT to Explore, What Domain Would You Choose?

0 Upvotes

I'm working on a VB.NET / C# Windows Forms project, and I want to avoid building another generic form where users enter data, click a button, and get a message box or a toast notification.

Instead, I'm looking for a domain that creates curiosity and engagement. Something where users keep exploring because they're excited to discover the next result, insight, recommendation, simulation, prediction, visualization, or outcome.

Examples of what I mean:

  • A domain that makes users think, "Let's try one more input and see what happens."
  • Something with personalized results.
  • Interactive visualizations.
  • Simulations or scenario testing.
  • Creative recommendations.
  • Hidden patterns or discoveries.
  • Gamified experiences.

I'm not looking for implementation ideas yet.

I'm looking for domains or problem spaces that would be exciting to build with Windows Forms and would give room for innovative UI, creative features, and a unique user experience.

If you had to choose a domain that would impress both users and faculty, what would it be and why?

Interested in suggestions from:

  • C# developers
  • VB.NET developers
  • UI/UX enthusiasts
  • Software engineering students
  • Project mentors
  • People who've built unique academic projects

Looking forward to some unconventional ideas.


r/dotnet • • 4h ago

Promotion TantivyDotNet: embedded full-text search eninge for .NET on top of Tantivy (Rust), 1.0 RC

Post image
14 Upvotes
For a while I've wanted something between "LIKE '%foo%'" and running Elasticsearch next to my app, and the main in-process option in .NET is still Lucene.NET 4.8, which has been in beta for years. Tantivy is a Rust search library in the same spirit as Lucene, so I wrote a .NET binding for it.


It ships as one NuGet package with the native library for Windows x64, Linux x64/arm64 and macOS x64/arm64, so there's no Rust toolchain on your side. It targets .NET 10+ and works with trimming and NativeAOT.


    using var index = SearchIndex.Create("./index", new SchemaBuilder()
        .AddTextField("title", stored: true)
        .AddTextField("body", stored: true)
        .AddI64Field("year", fast: true)
        .Build());


    using (var writer = index.CreateWriter())
    {
        writer.AddDocument(new { title = "Of Mice and Men", body = "...", year = 1937 });
        writer.Commit();
    }


    using var searcher = index.CreateSearcher();
    var results = searcher.Search("mice AND men", new SearchOptions
    {
        OrderBy = [SortBy.Field("year", descending: true)],
        Snippets = new SnippetOptions("body"),
    });


You can use query strings or build queries in code, and there are facets, snippets, sorting with search-after paging, and Elasticsearch-style aggregations. For servers, a SearcherManager hands out one shared searcher and refreshes it after commits.


I benchmarked it against Lucene.NET on 215k Wikipedia articles (setup and caveats in the repo):

Indexing is 2-3x faster and most queries are 4-7x faster. Phrase queries are about 4% slower, and that's Tantivy itself: called directly from Rust it takes about the same time.


The API is frozen as of the release candidate, and 1.0 ships once it's gone a few weeks without changes. The first feedback already turned up a real bug (paging cursors misbehaved after the index merged), fixed in rc.2. If something in the API looks off to you, now is when I can still change it.


    dotnet add package TantivyDotNet --prerelease


Repo: https://github.com/aminparsa18/TantivyDotNet
Docs: https://aminparsa18.github.io/TantivyDotNet/

r/dotnet • • 6h ago

Promotion I've created a Visual Studio add-in that uses GnuCOBOL as its back end

Thumbnail github.com
0 Upvotes

r/dotnet • • 8h ago

Promotion Unknot Code - a local-first codebase visualiser for code reviewers and editors

0 Upvotes

Hi all, Have you guys ever felt lost when reviewing/reading huge code bases? You reach somewhere skimming through code, jumped between files and methods, but it seems nowhere?
 You are diving deep into function definitions but lost track where you came from?
Hard to understand the downstream impacts due to a change?

Keeping all this in mind I built Unknot Code, a local-first codebase visualiser. Myself and my colleagues at work have been using it for past 2 month and feels incredible. Current version supports only #csharp and #python projects. TypeScript and Java planned next.

  • Works offline, so code stays within your machine.
  • Optional local AI code explanation, so small doubts doesn’t are sorted here itself [only if you have extra compute to burn].
  • Dedicated code review mode to help understand impacts and touch points.
  • Git diff mode to track changes.
  • Easy navigation and visualisation
  • Auto updates provided
  • No cost

And more.

https://www.unknotcode.com - check this out ! You can play around with it here.

Would genuinely love your feedbacks.


r/dotnet • • 14h ago

Promotion I've been building my own modular Discord bot framework in C# -- OpenBot

Thumbnail github.com
1 Upvotes

I've been working on a framework to make Discord bots fully modular, with a full framework. It works with "modules" which are part of the core bot itself and are required, and "extensions" which can be drag and dropped in to the bot's directory to add functionality.

I made (it's still in early development) this to solve a problem which I think everyone has experienced - they need a butt load of bots in their Discord server for all their different requirements.

It's open source, and I'm at the point where I'm starting to try to get it out there and would genuinely appreciate other .NET developers checking it out. Thanks.


r/dotnet • • 18h ago

Promotion We've ported an open-source WPF TreeGrid control to OpenSilver so it can run cross-platform (live web demo)

15 Upvotes

Hi .NET friends,

We've ported the awesome WPF TreeGrid control by gulshan-verma to OpenSilver, so it can run cross-platform (web, win, mac, linux, android & ios).

It's a XAML hierarchical data grid that supports MVVM and comes with a ton of features. The attached video shows a few of them.

It's MIT-licensed, it runs fast, and you can test it in the dedicated online playground at:

https://xaml.io/TreeGrid

On that site, you can drag and drop the TreeGrid control, then select it to see all of its options. There are still a few glitches that we're working on resolving, but it should be production-ready by the end of the year.

The full source code, along with a demo app, is available in the "OpenSilverPort" branch of https://github.com/OpenSilver/tree-grid-wpf

Please do share your feedback, so we can improve the TreeGrid!

Thanks a lot!

EDIT: Someone asked how much of the original code was preserved when porting from WPF to OpenSilver: the vast majority of the original C#/XAML code was preserved. We think more than 99%. The code is shared and we used compiler directives (#if OPENSILVER). You can see the full list of changes in the following commit (note that most of the files listed here are either Markdown or CSPROJ files, while only very little C#/XAML code was modified): https://github.com/OpenSilver/tree-grid-wpf/commit/cce756b5ea6c3087da6c81373ccb85fa00ab0fcb


r/dotnet • • 1d ago

David Whitney running TypeScript on the CLR, Razor on Astro, and more

Thumbnail youtube.com
26 Upvotes

We got u/davidwhitney along to the London .NET user group a few weeks back to talk about <checks notes> running TypeScript on the CLR, hotwiring Astro to use Razor as a template language, and, ah, creating native .NET bindings for React and JSX. You know, just completely normal sensible things to do... 🤣

It was a great session, which not only demonstrated the various injection and extension points in those libraries and languages - some intentional, some less so - but also got into the whole gnarly question of why developers favour one language over another, the contrast between different platforms and ecosystems. The video's up on YouTube if you want to check it out.


r/dotnet • • 1d ago

We ran 18 popular Windows installers through SmartScreen on a clean machine. The unsigned ones passed too.

0 Upvotes

I build a tool that runs real SmartScreen checks on Windows installers, and I wanted a baseline. So: a fresh Windows 11 VM for each file, downloaded from its real URL with Mark of the Web, then launched.

All 18 popular installers ran without a SmartScreen warning: 7-Zip, Notepad++, Git, Python, VLC, OBS, ShareX, qBittorrent, Zed, draw.io and others. Five of them carry no signature at all, including LocalSend's explicitly `-unsigned` build.

A 14 KB hello-world exe that nobody had downloaded before got "Windows protected your PC".

If you ship a .NET desktop app, this is the part that matters. SmartScreen keys reputation on the file hash and on the certificate. A signature doesn't buy you a pass. It gives your next release a way to inherit the reputation your last one earned. Every new build is a new hash and starts from zero unless the certificate carries it.

Write-up with the table, the method and its limits (one machine, one day):

https://signalscreen.dev/blog/smartscreen-popular-installers-unsigned?utm_source=reddit&utm_medium=post&utm_campaign=dotnet-18-installers

Every result has a public page with the hash and certificate. The hello-world

file is downloadable if you want to reproduce the warning yourself.


r/dotnet • • 2d ago

Benchmarking C# 15 [Union] Result, TryOut, and throw/catch (.NET 11 NativeAOT, with & without runtime-async) vs Rust

7 Upvotes

I benchmarked error-handling patterns in .NET 11 NativeAOT (C# 15 [Union] Result<int, ErrorCode>, classic TryOut, and throw/catch) against Rust (Result<i32, DomainError> and panic::catch_unwind), and also tested the impact of .NET 11's <Features>runtime-async=on</Features> on async paths. Tooling: hyperfine v2 (with hardware perf counters), .NET 11.0.100 NativeAOT (IlcInstructionSet=native, OptimizationPreference=Speed), Rust 1.100.0 (opt-level=3, lto=true, codegen-units=1, target-cpu=native, panic="unwind")

Sync (300M operations, 10% failures)

VariantWall [s]ns/opPeak RAM [MiB]InstructionsIPCCache MissBranch MissesRelative
Rust Result0.496 ± 0.0331.651.77.23B3.1983.2K (33.5%)335.1K1.00x
C# TryOut0.525 ± 0.0181.753.58.73B3.6793.9K (35.3%)4.1M1.06x
C# Result ([Union])1.497 ± 0.0154.993.512.39B1.77111.0K (29.6%)4.2M3.02x
C# Throw27.905 ± 0.14693.0254.4414.15B3.2147.3M (11.8%)44.5M56.21x
Rust Panic (catch_unwind)40.665 ± 0.214135.551.8657.66B3.4616.5M (8.5%)48.6M81.91x

Async (80M operations, 10% failures)

VariantWall [s]ns/opPeak RAM [MiB]InstructionsIPCCache MissBranch MissesRelative
Rust AsyncResult0.475 ± 0.0025.941.83.05B1.3734.4K (28.4%)388.3K1.00x
C# AsyncResult (runtime-async)0.512 ± 0.0036.403.56.27B2.7083.7K (35.3%)4.9M1.08x
C# AsyncResult (no runtime-async)2.111 ± 0.02226.393.517.08B1.75435.9K (35.5%)7.8M4.44x
C# AsyncThrow (runtime-async)8.643 ± 0.066108.0451.8131.34B3.3014.4M (12.5%)12.8M18.21x
C# AsyncThrow (no runtime-async)22.745 ± 0.032284.3152.4325.94B3.0969.7M (6.3%)89.7M47.84x

https://github.com/VladislavPrimakov/benchmarks#7-throw-vs-result-benchmark-c-nativeaot-vs-rust


r/dotnet • • 2d ago

Introducing DocumentExtractionClient (preview): Extract documents in .NET

Thumbnail devblogs.microsoft.com
99 Upvotes

r/dotnet • • 3d ago

I built a Roslyn analyzer for .NET that enforces architecture rules and flags allocations the compiler hides

0 Upvotes

I have been maintaining Clean Architecture codebases where the dependency

rules exist only in a wiki, and they rot anyway. So I built RungerHeimdall:

a Roslyn analyzer that enforces the rules at compile time.

What it does

Architecture (8 rules): layers declared in architecture.json, dependency

direction enforced, forbidden types and namespaces, namespace-must-match-folder,

repositories/services must be interfaces, framework allow-list, no static

mutable state, endpoints cannot construct infrastructure types.

Performance (20 rules): 12 deterministic allocation rules and 8 context-aware

ones. Examples: empty params array, ToList() before foreach, string concat in a

loop, struct compared through EqualityComparer<T>.Default (boxes), foreach over

non-generic IEnumerable of value types, Task.Run inside async, async void,

blocking on Task, repeated enumeration, ValueTask awaited twice,

Task.FromResult in a loop, Array.Resize in a loop.

Adoption: heimdall-baseline.json freezes existing violations so you only see

new ones. Temporary exemptions require a reason and can expire.

Hot paths: [HotPath]/[ColdPath], plus framework entry points (controllers,

hosted services, SignalR hubs, Minimal API handlers, Azure Functions,

MassTransit consumers), loops and iterators.

Honesty section: two of my original rules (empty params, Enum.HasFlag)

measured 0 B on .NET 9 because the JIT now removes the allocation. I

downgraded both to info and published the numbers. The benchmark table is at

https://github.com/rungerheimdall/rungerheimdall/blob/main/docs/benchmarks.md

Quick try:

dotnet add package RungerHeimdall.Analyzers --version 1.1.1

heimdall init

dotnet build

Rule reference (filterable): https://rungerheimdall.github.io/rungerheimdall/rules.html

Repo: https://github.com/rungerheimdall/rungerheimdall

Package: https://www.nuget.org/packages/RungerHeimdall.Analyzers

MIT, no telemetry. I am the author. Feedback on false positives would be the

most useful thing right now — that is what kills analyzers.


r/dotnet • • 3d ago

Looking for a good Cursor prompt to understand an unfamiliar .NET web service codebase

Thumbnail reddit.com
0 Upvotes

r/dotnet • • 4d ago

Run local models in your .NET apps with Llama on Windows

Thumbnail devblogs.microsoft.com
43 Upvotes

r/dotnet • • 4d ago

Deployment of aspnetcore on IIS (2027)

25 Upvotes

It is 2027 (or almost). We are hosting aspnetcore apps inprocess on IIS. We have tried using file-based deployments to production, and keep encountering errors when dlls are locked/in-use. We also tried the webdeploy approach with offline file for graceful shutdown ("App_offline.htm") but it is unreliable.

Is using shadow-copy still the recommended approach for consistent deployments in 2027? I'm getting really tired of fighting IIS on our production-deployment weekends.

Rick Strahl wrote a blog about this a number of years ago and it seems to keep surfacing as the correct approach for normal IIS deployments every year. I would rather be deploying apps on k8s in linux, but such things are out of my control. So I want to make sure IIS is as smooth as we can make it. Any tips would be appreciated.

Edit. I realize I'm approaching answers with a lot of confirmation bias. Can someone tell me if we should NOT use the shadow-copy deployment mechanism? What are the drawbacks that I might be missing?


r/dotnet • • 4d ago

Tracking dotnet sdk and runtime version on a container image

5 Upvotes

Now is one of those days where I definitly overthink a problem for not much added benefits. But I do want to see if other people have had this issue and how they handled it.

With this many CVEs detected on dotnet itself in the past few weeks, the need to patch our runtime and our build has become much more important. Our dotnet apis are deployed in containers, built in a multistage build, using the mcr.microsoft.com/dotnet/sdk:10.0 and mcr.microsoft.com/dotnet/aspnet:10.0 images. So far, we don't have a way to know which sdk patch version was used to build the image, and the only way to see what version of dotnet we run in prod is to go on the pod and run "dotnet --version". So, I'm looking for a solution to automate patching and track which version of dotnet is used in each of our environments.

At first, I tough of simply automating our deployment so that we simply rebuild and deploy a new image, assuming that the patched version will be the pulled version. But that doesn't solve the issue of knowing which version of dotnet is used after the fact. But it is quick.

After brainstorming with AI, I'm thinking of using this solution:

  1. Tag the exact patch version (10.0.404 for sdk and 10.0.15 for runtime) in the dockerfile's FROM instruction.
  2. Manage image update using GitHub's dependabot, configuring it to check for a new update daily.
  3. Get the configured versions using these commands in my deployment pipeline:dockerfile=Dockerfile runtime_version=$(sed -nE 's|[[:space:]]*FROM[[:space:]]+mcr.microsoft.com/dotnet/aspnet:([[:space:]@]+.*|\1|Ip') "$dockerfile") sdk_version=$(sed -nE 's|[[:space:]]*FROM[[:space:]]+mcr.microsoft.com/dotnet/sdk:([[:space:]@]+.*|\1|Ip') "$dockerfile") if [[ ! "$runtime_version" =~ [0-9][a-zA-Z0-9_.-]*$ || ! "$sdk_version" =~ [0-9][a-zA-Z0-9_.-]*$ ]]; then echo "Expected exactly one versioned .NET runtime and SDK image in $dockerfile" >&2 exit 1 fi
  4. Add the extracted version numbers as annotations on the image.

I don't like this big command, nor do I like not getting the actual version from the docker image runtime itself, but this is the best solution I found so far. The sdk version used is explicitly defined in the repository with the code deployed, the PR is created automatically when a new patch is available, and I can consult the dotnet version used in every environment by inspecting the image in the container registry. But I don't like that we'll have to managed this process in all of our repositories whenever a new patch is made available (which is quite often these days).

Do you track which dotnet version is used by your containers in your environments? Or do you simply tag the minor version (10.0) and leave it be? Did you have any issues patching your environments because of the recent CVEs? Is this a stupid problem?

Thx for the feedback!

EDIT - SELECTED SOLUTION:

If you're interested, here's how we decided to do it.

  1. Tag the dotnet patch explicitly in the Dockerfile
  2. Update it using dependabot
  3. Use commit annotation to know which commit created which image, thus knowing which dotnet version was used

We already used the docker annotations action before, so the commit used to build our image is already tracked. Now that the version of dotnet used is also tracked in the repository, we have a simple way to know which version was used.

@chucker23n noted that indeed, an inventory tool would be more appropriate. In an ideal world, I'd say we'd need to generate an SBOM of our application's dependencies, and link them to the image in our repository. A security tool could inspect our container registries, store the dependencies used, and flag the appropriate team if a vulnerability is detected on a specific dependency. But that's definitly a problem for a security team that could manage such a tool centrally. We'll comply if its ever needed. But for now, the solution I found fits our need.


r/dotnet • • 4d ago

C# 15 on a Commodore 64 🕹️

71 Upvotes

Records, unions and pattern matching, compiled ahead of time to native 6502 code. No VM, no GC. The whole game, SID music included, is 37 KB on a 1 MHz machine from 1982.

github.com/OnurGumus/zero-csharp


r/dotnet • • 4d ago

How do you set up your Agentic .NET Environment?

Thumbnail reddit.com
0 Upvotes

r/dotnet • • 4d ago

Promotion DataVo v0.4: an open-source embedded SQL, vector, and reactive DB engine in pure C# (beating SQLite and DuckDB on hot-path lookups & IVM)

13 Upvotes

For the last 9 months I've been building DataVo, an embedded database written entirely in C# on .NET 10. There are no native binaries, so no P/Invoke and no UTF-8/UTF-16 conversion on every string. It publishes with Native AOT and zero trim warnings.

The idea I kept coming back to: a lot of what a query engine does at runtime can happen at build time. Roslyn source generators and LINQ interceptors turn [DataVoTable] types and [DataVoQuery] methods into code that reads straight out of byte buffers. No reflection, no expression trees compiled at runtime.

Here is what that looks like in practice:

[DataVoTable("players")]
public sealed class Player
{
[PrimaryKey] public int Id { get; set; }
public string Name { get; set; } = "";
}
var players = db.Table<Player>();
// Point lookup. The interceptor rewrites this call site at build time.
Player? p = players.FirstOrDefault(42, static (p, key) => p.Id == key);
// Filtered count over a [Columnar] column, 0 B allocated per call.
int elites = players.Where(1000, static (p, min) => p.Score >= min).Count();

The lambdas are static and take their argument as explicit state, which is what lets the generator compile them. If it can't translate one, you get a build warning and it falls back to a slower path that still returns exact results.

Numbers from one Apple M4 Pro, 100,000 rows, BenchmarkDotNet (methodology and raw output are in the write-up):

  • Primary-key lookup in memory: 55 ns for DataVo, 716 ns for SQLite.
  • Primary-key lookup on disk (DataVo LSM vs SQLite WAL): 216 ns vs 1,654 ns.
  • Filtered COUNT/SUM/MIN/MAX over 200,000 rows through compiled LINQ: no allocation, about 9 to 10 times faster than SQLite.

It loses too. GROUP BY over 125,000 groups of an indexed key, unindexed ORDER BY ... LIMIT, and full scans with OR or LIKE are slower than SQLite. DuckDB is faster than both of us on anything that reads the whole table. On a durable write, both DataVo and SQLite wait for the same ~4 ms fsync, so the lookup speedup doesn't matter there.

Other things in 0.4:

  • Large scans stream in 1,024-row pages. StreamRef() yields stack-only RowRef spans over reused buffers, so it allocates 0 bytes per row after warmup.
  • Live reactive views built on delta batches (DBSP-style), with SubscribeInto writing into a Memory<T> you own.
  • VECTOR(n) columns with FLAT and HNSW indexes (SIMD) in the same transaction log.
  • An ADO.NET provider that works with Dapper.
  • The disk engine is an LSM with a WAL and memory-mapped SSTables.

What it isn't: not client/server, one process owns the database directory, transactions are snapshot isolation (not serializable), and the SQL dialect is its own.

MIT licensed. DataVo.Data 0.4.0-rc.1 is on NuGet.

Source: https://github.com/ArintonAkos/DataVo-DBMS
Benchmarks, including the losses: https://arintonakos.github.io/DataVo-DBMS/blog/part-1-where-it-wins-and-where-it-loses

If you do Native AOT or local-first work, what's the first query you would throw at it? I would rather get a failing one than a polite reply.


r/dotnet • • 5d ago

Promotion Codalus IDE 1.0: a free, open-source .NET IDE for Windows, macOS and Linux, from console apps to WinForms, MAUI and Blazor

60 Upvotes

Codalus IDE 1.0 is out. It's a free, MIT-licensed IDE for .NET, native on all three desktop OSes, with the classic IDE's layout and keyboard scheme.

What it covers:

  • C#, VB and F# on Roslyn and the F# language server: refactorings with previews, your analyzers and source generators, and Code Search
  • A real project system: .sln and .slnx, SDK-style and old-style .NET Framework projects on MSBuild, property pages, multi-targeting and NuGet
  • Web: ASP.NET Core, .http files, an Endpoints Explorer, and Blazor debugged across the server and the browser
  • Desktop and mobile: Avalonia (previewer and XAML Hot Reload everywhere), the Windows Forms designer with a Toolbox that reads control libraries' controls, the WPF XAML Previewer, WinUI 3, and .NET MAUI on Android, iOS simulators and Mac Catalyst
  • Its own debugger: Hot Reload while debugging, inline values, async call stacks, Set Next Statement, Disassembly, Registers and Memory windows
  • Tests for xUnit, NUnit, MSTest and TUnit, with coverage; profiling with flame graphs and memory snapshots; EF Core migrations and model views; a Database Explorer
  • Git across every repository of a solution, with a 3-way merge editor, interactive rebase and pull requests on GitHub, GitLab and Azure DevOps
  • Remote: SSH, WSL, containers and Dev Containers
  • Aspire and containers with your docker or podman

No telemetry, and AI stays off until you turn it on.

Download: https://codalus.dev/download/ (installers that update themselves, plus apt and dnf repositories). It needs the .NET 11 SDK. The Windows installer isn't signed yet, so SmartScreen asks once.

What's new in 1.0: https://codalus.dev/docs/whats-new/ 
Source: https://github.com/stavroskasidis/codalus-ide

Feedback is very welcome, especially from big or unusual solutions.


r/dotnet • • 5d ago

Question SCA said a vulnerable wasn't reachable but we load it with Activator.CreateInstance

1 Upvotes

We moved ~30 services to . NET 10 when 8 went out of support and flipped NuGet audit warnings to errors while were at it. When we decide a CVE doesn't affect us, we add a suppression in Directory.Build.props with a comment and a date as it again

<!-- not reachable per SCA trial, recheck 2027-02 -->
<NuGetAuditSuppress Include="https://github.com/advisories/GHSA-xxxx-xxxx-xxxx" />

We're also trialing an SCA tool with reachability and it marks most of our open advisories as not reachable. Before trusting that, I pulled 25 of the not reachable ones and went through them with a colleague. 22 looked right, 2 we couldn't tell either way and 1 was flat out wrong.

The wrong one is a serializer inside a plugin assembly we load by type name from appsettings with Activator.CreateInstance. Nothing in our code calls it directly which am guessing is why the tool missed it. it also runs the service that makes file uploads, which is great.

Kind of feels like the other 22 are only right because those services dont do anything clever yet.

How far do you trust a non-reachable verdict when there's DI and reflection in the mix?


r/dotnet • • 5d ago

TantivyDotNet 1.0 RC: embedded full-text search for .NET on top of Tantivy, looking for API feedback

4 Upvotes

I've been building TantivyDotNet, a .NET binding for Tantivy, the search library that plays Lucene's role in the Rust world. It's one NuGet package with the native libraries for Windows, Linux and macOS on x64 and arm64, and it works with trimming and NativeAOT. It targets .NET 10 and later.

You define a schema, index into a directory or into memory, and search with the query parser or with typed queries. Snippets, facets, multi-key sorting with search-after paging and Elasticsearch-style aggregations are in. So is a SearcherManager, for serving many requests from one index snapshot.

On 215k Wikipedia articles it indexes 2-3× faster than Lucene.NET 4.8 and runs term, AND, OR and sorted queries 4-7× faster. Phrase queries are the exception, about 4% slower. The README describes the benchmark setup.

1.0.0-rc.1 freezes the public API, and after 1.0.0 it stays fixed for all of 1.x, so this is the last chance to rename things or change defaults. If any part of the API looks wrong or awkward to you, I'd like to know. I'm also interested in what you'd need before replacing Lucene.NET or a separate search server with it, and in bug reports, especially from containers or less common platforms.

```

dotnet add package TantivyDotNet --version 1.0.0-rc.1

```

Docs: https://aminparsa18.github.io/TantivyDotNet/

Repo and issues: https://github.com/aminparsa18/TantivyDotNet


r/dotnet • • 5d ago

Promotion File-based app coding agent

0 Upvotes

Just wanted to showcase a coding agent using file based apps. I can't lie this was the best thing they brought to .NET 10 in a long time.

#:package HPD-Agent.Framework@0.9.7
#:package HPD-Agent.Providers.OpenAI@0.9.7
#:package HPD-Environment.HostProcess@0.9.7
#:package HPD-Agent.ToolHarness.Coding@0.9.7


using System.Runtime.CompilerServices;
using HPD.Agent;
using HPD.Agent.Goals;
using HPD.Agent.Planning;
using HPD.Agent.Permissions;
using HPD.Agent.Sandbox;
using HPD.Agent.Providers.OpenAI;
using HPD.Environment.HostProcess;


var dataRoot = Path.Combine(Directory.GetCurrentDirectory(), ".hpd-data");
var scriptDirectory = Path.GetDirectoryName(Path.GetFullPath(GetScriptFilePath()))
    ?? throw new InvalidOperationException("Could not determine the script directory.");
var workspacePath = Path.Combine(scriptDirectory, "workspace");


var codingAgent = await new AgentBuilder()
    .WithOpenAI(model: "gpt-6.2-astra")
    .WithFileSessionStore(Path.Combine(dataRoot, "sessions"))
    .WithPlanMode()
    .WithPermissions(AuthorizationMode.Bypass)
    .WithGoals()
    .WithSandbox(
        new HostProcessProviderModule(),
        HostProcessSandbox.ForDirectory(workspacePath))
    .WithToolHarness<CodingToolHarness>()
    .BuildAsync();


var sessionId = await codingAgent.CreateSessionAsync();


using var output = codingAgent.Subscribe<TextDeltaEvent>(evt => Console.Write(evt.Text));


using var finished = codingAgent.Subscribe<MessageTurnFinishedEvent>(_ => Console.WriteLine());


using var toolStarted = codingAgent.Subscribe<ToolCallStartEvent>(
    evt => Console.WriteLine($"\nTool: {evt.Name}"));
using var permissions = codingAgent.Subscribe<PermissionRequestEvent>(
    new ThreadKey(sessionId, "main"),
    AgentEventHierarchy.ThreadAndDescendants,
    async Task (request) =>
    {
        var label = request.FunctionName ?? request.Authority ?? request.PermissionDomain;
        var allowOnce = request.Choices.FirstOrDefault(choice => choice.Id == "allow_once");
        var allowSession = request.Choices.FirstOrDefault(choice => choice.Id == "allow_session");
        var deny = request.Choices.FirstOrDefault(choice => choice.Id == "deny_once");
        var selectedChoice = deny;


        if (!Console.IsInputRedirected)
        {
            var options = allowSession is null
                ? "[y] allow once / [N] deny"
                : "[y] allow once / [a] allow for this session / [N] deny";
            Console.Write($"\n[permission] {label} {request.Action}? {options} ");


            var response = Console.ReadLine()?.Trim();
            if (string.Equals(response, "y", StringComparison.OrdinalIgnoreCase))
                selectedChoice = allowOnce ?? deny;
            else if (allowSession is not null &&
                     string.Equals(response, "a", StringComparison.OrdinalIgnoreCase))
                selectedChoice = allowSession;
        }
        else
            Console.Error.WriteLine($"[permission] Non-interactive input; denying {label}.");


        if (selectedChoice is null)
            throw new InvalidOperationException(
                $"Permission request for {label} has no supported allow or deny choice.");


        await codingAgent.AnswerRequestAsync(new PermissionResponseEvent(
            request.PermissionId,
            request.SourceName,
            selectedChoice.Id));
    });


await codingAgent.StartAsync();
try
{
    while (true)
    {
        Console.Write("\nYou: ");
        var input = Console.ReadLine();


        if (string.IsNullOrWhiteSpace(input))
            break;

        Console.Write("Agent: ");
        using var runCancellation = new CancellationTokenSource();
        if (!Console.IsInputRedirected)
        {
            _ = Task.Run(async () =>
            {
                try
                {
                    while (!runCancellation.IsCancellationRequested)
                    {
                        if (Console.KeyAvailable && Console.ReadKey(intercept: true).Key == ConsoleKey.Escape)
                        {
                            runCancellation.Cancel();
                            break;
                        }


                        await Task.Delay(10, runCancellation.Token);
                    }
                }
                catch (OperationCanceledException)
                {
                }
            });
        }


        try
        {
            _ = await codingAgent.RunAsync(
                input,
                sessionId: sessionId,
                cancellationToken: runCancellation.Token);
        }
        catch (OperationCanceledException)
        {
            Console.WriteLine("\n[run cancelled]");
        }
        finally
        {
            runCancellation.Cancel();
        }
    }
}
finally
{
    await codingAgent.StopAsync();
}


static string GetScriptFilePath([CallerFilePath] string sourceFilePath = "") => sourceFilePath;