Skip to main content

Posts

Showing posts from 2025

How to read build variables in Source Generators

How to read build variables in Source Generators I used GitHub copilot to help me create a source generator that reads the schema of a database and generates C# ADO.net code that can call SQL Stored Procedures, Views and Functions in that database ( https://github.com/TheJuanitoLearnsShow/Puppy.Ado.SourceGenerator ). The connection string to the database is set on a build variable in the consuming csproj file. The problem is that copilot missed the step described in Microsoft’s Source Generator Cookbook . The missing step is to add a CompilerVisibleProperty element to an ItemGroup for each of the build variables you want the source generator to use. For example, my source generator uses two build variables: DbGen_EnableLiveSchema and DbGen_ConnectionString, so they are defined in the PropertyGroup element in the consuming csproj file: <DbGen_EnableLiveSchema>true</DbGen_EnableLiveSchema> <DbGen_ConnectionString>Data Source=.\sqlExpress;Database=AutomatedTESTS_AdoGen...

APIM requests not showing downstream requests in application

APIM requests not showing downstream requests in application insights In Application Insights, if you are not seeing the telemetry for the backend service being called by APIM, it could be you have the wrong type of correlation type option set under that API’s settings in APIM. The correct setting, for newer web apps that use the latest open telemetry or application insights nugets should be W3C . The default value is Legacy so you will need to change it to W3C. Without that correlation, the appropriate headers will not be included in the request to the backend service from APIM and the two parts of the request would appear as separate flows inside Application Insights.