Troubleshooting
Build error
Radzen Blazor Studio builds your application in order to show it in design time. Sometimes this build fails and you will see the “Oh, no! The build failed.” message which also 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 Studio as well. Fix the reported errors and try again.
- Your application builds and runs as expected but Radzen Blazor Studio fails with the design-time build. This usually happens when Radzen Blazor Studio 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. You can use Radzen Blazor Studio to analyze your project for problems and send us the output.
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 in Radzen Blazor Studio. You will see the “Oh, no! Page threw exception during rendering.” message.
Radzen Blazor 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. You can use Radzen Blazor Studio to analyze your project for problems and send us the output.
Package restore errors
If you get error NU1301: Failed to retrieve information about XXX from remote source
make sure the default NuGet package source is
nuget.org
. Any third party package sources should come after it. You can verify that from Visual Studio.
Analyze
Radzen Blazor Studio can analyze your project for potential design-time build or render issues. If you experience problems here is how to run the analysis.
Note: The analyze option requires Radzen Blazor Studio 1.0.6+.
You can terminate the analysis at any time by pressing CTRL+C (Windows) or CMD+C (macOS).
Analyze on Windows
Open a command prompt. Then run the following command
dotnet "c:\Program Files\Radzen Blazor Studio\resources\Radzen.Server\Radzen.Server.dll" --analyze <path to the .sln or .csproj of your application> -o <log file>
For example
dotnet "c:\Program Files\Radzen Blazor Studio\resources\Radzen.Server\Radzen.Server.dll" --analyze c:\apps\BlazorApp\BlazorApp.sln -o log.txt
This command will analyze the c:\apps\BlazorApp\BlazorApp.sln
solution and output the information to the log.txt
file. You can omit the -o log.txt
parameter if you
want to see the output in the console.
Analyze on macOS
Open a terminal. Then run the following command
dotnet /Applications/Radzen\ Blazor\ Studio.app/Contents/Resources/Radzen.Server/Radzen.Server.dll --analyze <path to the .sln or .csproj of your application> -o <log file>
For example
dotnet /Applications/Radzen\ Blazor\ Studio.app/Contents/Resources/Radzen.Server/Radzen.Server.dll --analyze ~/apps/BlazorApp/BlazorApp.sln -o log.txt
This command will analyze the ~/apps/BlazorApp/BlazorApp.sln
solution and output the information to the log.txt
file. You can omit the -o log.txt
parameter if you
want to see the output in the console.
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)
If you have a log file from analyzing your project attach it to your report.
Log file
Radzen Blazor Studio logs various info (including unexpected exceptions and other problems). The location depends on the host OS:
Windows
%APPDATA%\Radzen Blazor Studio\log.txt
macOS
~/Library/Application Support/Radzen Blazor Studio/log.txt
Linux
~/.config/Radzen Blazor Studio/log.txt
or $XDG_CONFIG_HOME/Radzen Blazor Studio/log.txt
CSS does not load in design time
Radzen Blazor Studio will search for _Host.cshtml
or index.html
files in your application and parse them 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 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.
You can enable the Blazor lifecycle from Radzen Blazor Studio settings (the button in the bottom left corner). Do so at your own risk.
Changes do not appear when the application is run
Radzen Blazor Studio does not automatically save file changes. Press ctrl+S
to save the current file or ctrl+alt+S
to save all open files.