Back to articles
How We Plan to Use C# 14 Interceptors to Eliminate Reflection in Ivy

How We Plan to Use C# 14 Interceptors to Eliminate Reflection in Ivy

via Dev.toNiels Bosma

What is Ivy? Ivy is an open-source .NET framework for building internal applications with AI and pure C#. Think of it as a server-driven UI framework: you write your entire app in C# — layout, state, events — and Ivy renders it in the browser. Widgets like Button , TextBlock , and DataTable are plain C# classes decorated with [Prop] and [Event] attributes, and the framework serializes them to JSON on every render cycle to ship the UI state to the frontend. This architecture is powerful, but it comes with a cost: reflection . Today, Ivy leans on PropertyInfo.GetValue() , GetCustomAttribute<T>() , and assembly scanning in several hot paths. With C# 14 shipping interceptors as a first-class feature, we see an opportunity to eliminate that overhead entirely — at compile time, with zero runtime cost. This article walks through our concrete plan. The Problem: Reflection in Hot Paths Ivy uses runtime reflection in four key areas: 1. Widget Serialization (hottest path) Every time a widget rend

Continue reading on Dev.to

Opens in a new tab

Read Full Article
6 views

Related Articles