Render error RBS

I can run the project in RBS but i can´t render pages. This is what the error says.

The project runs fine i Visual Studio 2022 Version 17.4.4.

RBS Verison is 1.2.4

Program.cs(41,32): error CS0103: The name 'builder' does not exist in the current context

image

Missing partial modifier on declaration of type 'Program'; another partial declaration of this type exists

image

Hi @Gottegubben,

We would need your application in order to troubleshoot. Send a link to it at info@radzen.com.

The project is pretty big... I will try to create a demo project with the same errors.

Found the problem

var http = new HttpClient()
{
    BaseAddress = new Uri(builder.HostEnvironment.BaseAddress),
};
builder.Services.AddScoped(sp => http);
using var response = await http.GetAsync("appsettings.json");
using var stream = await response.Content.ReadAsStreamAsync();
builder.Configuration.AddJsonStream(stream);

This is in my program.cs to get the url for the api project.
I can run this fine in Visual Studio but not i RBS.

We will investigate. For the moment you can use the preprocessor to hide this code from RBS.

1 Like