Troubleshooting
Build error
Radzen Blazor for Visual Studio builds your application in order to show it in design time. Sometimes this special build fails and you will see a message in the designer which asks you to check the Output window. The build could fail for two reasons:
- Your application doesn’t build in general in its current state. If your application fails to build in Visual Studio or from command line then it won’t build in Radzen Blazor for Visual Studio as well. Fix the reported errors and try again.
- Your application builds and runs as expected but Radzen Blazor for Visual Studio fails with the design-time build. This usually happens when Radzen Blazor for Visu didn’t recognize some vital part of your application startup and didn’t include it in the design-time build - some service registration for example. In other cases it is some startup code that throws an exception during design-time build.
Hide code from design-time builds
Use the RADZEN
preprocessor constant if there is code you don’t want Radzen Blazor Studio to include in design-time builds.
In C# files
#if !RADZEN
// This code will not be included in Radzen Blazor Studio design-time builds
builder.Services.AddScoped<ITradeService, TradeService>();
#endif
In razor files
@{ #if !RADZEN }
<RadzenButton Text="Hidden in design builds" />
@{ #endif }
Render error
Sometimes certain pages may fail to display.
Radzen Blazor for Visual Studio does not execute the Blazor lifecycle methods of your pages in order to prevent unwanted side effects such as database access, HTTP requests or file system access. Instead it adds code that initializes the page members (properties and fields) with sample data. This process could fail in some cases.
Report an issue
If you hit a problem with Radzen Blazor Studio you can report it by:
- Starting a forum thread
- Sending us an email to info@radzen.com (only for Radzen Blazor Studio Professional or Enterprise subscribers)
CSS does not load in design time
Radzen Blazor for Visual Studio will scan the _Host.cshtml
, App.razor
or index.html
files in your application for CSS and JS. It also supports component specific CSS files (*.razor.css
).
If you are including a CSS file by other means they may not display in design-time.
Code in lifecycle methods does not execute in design-time
Radzen Blazor for Visual Studio does not execute the Blazor lifecycle methods of your pages in order to prevent unwanted side effects such as database access, HTTP requests or file system access. Instead it adds code that initializes the page members (properties and fields) with sample data.