We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The razor source generator requires every .cshtml or .razor file to have an associated TargetPath metadata item. We report a diagnostic to say that a given item didn't have a target path (https://github.com/dotnet/sdk/blob/4ac98544c9b8e1a1e433675b9bd3290c0d0578d5/src/RazorSdk/SourceGenerators/RazorSourceGenerator.RazorProviders.cs#L73) but try and continue when it is empty.
.cshtml
.razor
TargetPath
We should warn and stop processing when the target path is either null or empty.
null
The actual crash happens because
RazorSourceGenerator.ComputeProjectItems
SourceGeneratorProjectItem.RelativePhysicalPath
CreateNewOnMetadataUpdateAttributePass
RazorCompiledItemMetadataAttributeIntermediateNode
MetadataAttributeTargetExtension
Value
CodeWriter.WriteStringLiteral
The text was updated successfully, but these errors were encountered:
AdditionalFiles.TargetPath
jjonescz
Successfully merging a pull request may close this issue.
The razor source generator requires every
.cshtml
or.razor
file to have an associatedTargetPath
metadata item. We report a diagnostic to say that a given item didn't have a target path (https://github.com/dotnet/sdk/blob/4ac98544c9b8e1a1e433675b9bd3290c0d0578d5/src/RazorSdk/SourceGenerators/RazorSourceGenerator.RazorProviders.cs#L73) but try and continue when it is empty.We should warn and stop processing when the target path is either
null
or empty.The actual crash happens because
RazorSourceGenerator.ComputeProjectItems
finds an empty value, not anull
so continueshttps://github.com/dotnet/sdk/blob/4ac98544c9b8e1a1e433675b9bd3290c0d0578d5/src/RazorSdk/SourceGenerators/RazorSourceGenerator.RazorProviders.cs#L65
SourceGeneratorProjectItem.RelativePhysicalPath
receives an empty value https://github.com/dotnet/sdk/blob/04b2d8c35736410847ae8c8d8035abfc61398a8c/src/RazorSdk/SourceGenerators/SourceGeneratorProjectItem.cs#L19null
due to the relative path beingnull
or empty https://github.com/dotnet/razor-compiler/blob/a4df79c2bcf7d6e79cf870f84cf9fe3170c83fcf/src/Microsoft.AspNetCore.Razor.Language/src/Extensions/DefaultMetadataIdentifierFeature.cs#L28CreateNewOnMetadataUpdateAttributePass
creates annull
valuedRazorCompiledItemMetadataAttributeIntermediateNode
https://github.com/dotnet/razor-compiler/blob/77912f7f843df05dc8c106a87188985834a0b632/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/src/CreateNewOnMetadataUpdateAttributePass.cs#L48
MetadataAttributeTargetExtension
passes thenull
valuedValue
to theCodeWriter.WriteStringLiteral
which throws.https://github.com/dotnet/razor-compiler/blob/77912f7f843df05dc8c106a87188985834a0b632/src/Microsoft.AspNetCore.Razor.Language/src/Extensions/MetadataAttributeTargetExtension.cs#L62
The text was updated successfully, but these errors were encountered: