Events
Power BI DataViz World Championships
Feb 14, 4 PM - Mar 31, 4 PM
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn moreThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This document lists known breaking changes in Razor after .NET 8 general release (.NET SDK version 8.0.100) through .NET 9 general release (.NET SDK version 9.0.100).
Introduced in VS 17.10 and .NET 8.0.300
In https://github.com/dotnet/razor/pull/10232, we adjusted the behavior of how an identifier is parsed following an @
to be more consistent across Razor.
This resulted in a few scenarios that have different behavior, listed below.
Strings of the form @$"ticket-{i}.png"
are no longer recognized. This will be fixed in a later release by changing to a new lexer; until then, use $@
to work around the issue.
@{
#region R
<h3>@ViewData["Title"]</h3>
#endregion
}
switch
statements:@{
switch (true)
{
#region R
case true:
<div>@(1 + 1)</div>
break;
}
}
Previously, C# preprocessor directives followed by HTML would sometimes be parsed correctly if the HTML had an @
transition in it. It is now consistently parsed
incorrectly. This will be resolved in a later release by changing to a new lexer. Until then, there are available workarounds to get this to compile.
The HTML can be surrounded with braces.
@{
#if DEBUG
{
<h3>@ViewData["Title"]</h3>
}
#endif
}
Directives such as #region
and #endregion
allow putting a semicolon after the directive. This will effectively work around the issue.
@{
#region R ;
<h3>@ViewData["Title"]</h3>
#endregion
}
Directives such as #if
and #endif
do not allow semicolons after the directive condition, but one can be placed on the next line to make an empty statement.
@{
#if DEBUG
;
<h3>@ViewData["Title"]</h3>
#endif
}
ASP.NET Core feedback
ASP.NET Core is an open source project. Select a link to provide feedback:
Events
Power BI DataViz World Championships
Feb 14, 4 PM - Mar 31, 4 PM
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn moreTraining
Module
Vytváření bohatých interaktivních komponent pomocí webových aplikací Blazor - Training
Naučte se spolupracovat s aplikacemi Blazor s kódem JavaScriptu, používat šablonované komponenty a zpracovávat události životního cyklu komponent.