<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Roslyn on InternetException</title><link>https://internetexception.com/tags/roslyn/</link><description>Recent content in Roslyn on InternetException</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Fri, 02 Oct 2026 12:00:00 +0200</lastBuildDate><atom:link href="https://internetexception.com/tags/roslyn/index.xml" rel="self" type="application/rss+xml"/><item><title>Type is safe to use for equality in Roslyn source generators</title><link>https://internetexception.com/2026-10-02/type-is-safe-to-use-for-equality-in-roslyn-source-generators/</link><pubDate>Fri, 02 Oct 2026 12:00:00 +0200</pubDate><guid>https://internetexception.com/2026-10-02/type-is-safe-to-use-for-equality-in-roslyn-source-generators/</guid><description>&lt;p&gt;Lately I am playing a lot with Roslyn Source Code generators. This allows you to do interesting things, like automatic generation of validation classes based on data in the domain layer. Or generating tests that check if your API endpoints return 200 OK when a bare GET request is sent.&lt;/p&gt;&#10;&lt;p&gt;One thing you have to remember to do is use types with strict value equality. Otherwise it may work incorrectly or it may leak memory. You can, for example, use &lt;code&gt;records&lt;/code&gt; that do that for you, with the gotcha being &lt;em&gt;no extra fields or properties&lt;/em&gt;. Because of that I was mostly translating &lt;code&gt;Type&lt;/code&gt;s into other values, i.e., the full name of the type, to avoid equality issues. But it turns out you can use it in &lt;code&gt;IValueProvider&lt;/code&gt; directly.&lt;/p&gt;</description></item></channel></rss>