aspnetcore: Building in VS from aspnetcore repo, .razor files failing with CS0649 (Field is never assigned to) and RZ9991 (Attribute names could not be inferred)
This seems to be a new issue since yesterday, as far as I can tell. Note that it works fine when building from the command line.
Repro: Open ComponentsNoDeps.slnf in Visual Studio and try to build BasicTestApp
2>------ Build started: Project: BasicTestApp, Configuration: Debug Any CPU ------
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\FormsTest\InputFileComponent.razor(8,170,8,182): error RZ9991: The attribute names could not be inferred from bind attribute 'bind-value'. Bind attributes should be of the form 'bind' or 'bind-value' along with their corresponding optional parameters like 'bind-value:event', 'bind:format' etc.
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\FormsTest\InputFileComponent.razor(13,283,13,299): error RZ9991: The attribute names could not be inferred from bind attribute 'bind-value'. Bind attributes should be of the form 'bind' or 'bind-value' along with their corresponding optional parameters like 'bind-value:event', 'bind:format' etc.
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\VirtualizationComponent.razor(3,87,3,95): error RZ9991: The attribute names could not be inferred from bind attribute 'bind-value'. Bind attributes should be of the form 'bind' or 'bind-value' along with their corresponding optional parameters like 'bind-value:event', 'bind:format' etc.
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\GlobalizationBindCases.razor(15,640,15,660): error RZ9991: The attribute names could not be inferred from bind attribute 'bind-value'. Bind attributes should be of the form 'bind' or 'bind-value' along with their corresponding optional parameters like 'bind-value:event', 'bind:format' etc.
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\GlobalizationBindCases.razor(27,1126,27,1153): error RZ9991: The attribute names could not be inferred from bind attribute 'bind-value'. Bind attributes should be of the form 'bind' or 'bind-value' along with their corresponding optional parameters like 'bind-value:event', 'bind:format' etc.
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\GlobalizationBindCases.razor(39,1612,39,1634): error RZ9991: The attribute names could not be inferred from bind attribute 'bind-value'. Bind attributes should be of the form 'bind' or 'bind-value' along with their corresponding optional parameters like 'bind-value:event', 'bind:format' etc.
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\GlobalizationBindCases.razor(52,2217,52,2244): error RZ9991: The attribute names could not be inferred from bind attribute 'bind-value'. Bind attributes should be of the form 'bind' or 'bind-value' along with their corresponding optional parameters like 'bind-value:event', 'bind:format' etc.
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\BindCasesComponent.razor(22,1131,22,1161): error RZ9991: The attribute names could not be inferred from bind attribute 'bind-value'. Bind attributes should be of the form 'bind' or 'bind-value' along with their corresponding optional parameters like 'bind-value:event', 'bind:format' etc.
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\BindCasesComponent.razor(24,1366,24,1396): error RZ9991: The attribute names could not be inferred from bind attribute 'bind-value'. Bind attributes should be of the form 'bind' or 'bind-value' along with their corresponding optional parameters like 'bind-value:event', 'bind:format' etc.
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\BindCasesComponent.razor(37,1894,37,1917): error RZ9991: The attribute names could not be inferred from bind attribute 'bind-value'. Bind attributes should be of the form 'bind' or 'bind-value' along with their corresponding optional parameters like 'bind-value:event', 'bind:format' etc.
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\BindCasesComponent.razor(67,3213,67,3230): error RZ9991: The attribute names could not be inferred from bind attribute 'bind-value'. Bind attributes should be of the form 'bind' or 'bind-value' along with their corresponding optional parameters like 'bind-value:event', 'bind:format' etc.
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\BindCasesComponent.razor(91,4297,91,4316): error RZ9991: The attribute names could not be inferred from bind attribute 'bind-value'. Bind attributes should be of the form 'bind' or 'bind-value' along with their corresponding optional parameters like 'bind-value:event', 'bind:format' etc.
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\BindCasesComponent.razor(136,6411,136,6439): error RZ9991: The attribute names could not be inferred from bind attribute 'bind-value'. Bind attributes should be of the form 'bind' or 'bind-value' along with their corresponding optional parameters like 'bind-value:event', 'bind:format' etc.
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\BindCasesComponent.razor(166,8113,166,8139): error RZ9991: The attribute names could not be inferred from bind attribute 'bind-value'. Bind attributes should be of the form 'bind' or 'bind-value' along with their corresponding optional parameters like 'bind-value:event', 'bind:format' etc.
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\BindCasesComponent.razor(178,8819,178,8852): error RZ9991: The attribute names could not be inferred from bind attribute 'bind-value'. Bind attributes should be of the form 'bind' or 'bind-value' along with their corresponding optional parameters like 'bind-value:event', 'bind:format' etc.
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\BindCasesComponent.razor(283,14378,283,14419): error RZ9991: The attribute names could not be inferred from bind attribute 'bind-value'. Bind attributes should be of the form 'bind' or 'bind-value' along with their corresponding optional parameters like 'bind-value:event', 'bind:format' etc.
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\BindCasesComponent.razor(297,15089,297,15122): error RZ9991: The attribute names could not be inferred from bind attribute 'bind-value'. Bind attributes should be of the form 'bind' or 'bind-value' along with their corresponding optional parameters like 'bind-value:event', 'bind:format' etc.
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\BindCasesComponent.razor(311,15740,311,15772): error RZ9991: The attribute names could not be inferred from bind attribute 'bind-value'. Bind attributes should be of the form 'bind' or 'bind-value' along with their corresponding optional parameters like 'bind-value:event', 'bind:format' etc.
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\BindCasesComponent.razor(325,16455,325,16491): error RZ9991: The attribute names could not be inferred from bind attribute 'bind-value'. Bind attributes should be of the form 'bind' or 'bind-value' along with their corresponding optional parameters like 'bind-value:event', 'bind:format' etc.
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\SignalRClientComponent.razor(31,31,31,44): error CS0649: Field 'SignalRClientComponent.transportType' is never assigned to, and will always have its default value
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\MultipleChildContent.razor(24,10,24,20): error CS0649: Field 'MultipleChildContent.ShowFooter' is never assigned to, and will always have its default value false
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\EventCustomArgsComponent.razor(80,10,80,38): error CS0649: Field 'EventCustomArgsComponent.customKeyDownStopPropagation' is never assigned to, and will always have its default value false
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\EventBubblingComponent.razor(81,10,81,31): error CS0649: Field 'EventBubblingComponent.targetStopPropagation' is never assigned to, and will always have its default value false
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\EventBubblingComponent.razor(83,10,83,26): error CS0649: Field 'EventBubblingComponent.preventOnKeyDown' is never assigned to, and will always have its default value false
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\HttpClientTest\CookieCounterComponent.razor(19,12,19,29): error CS0649: Field 'CookieCounterComponent.testServerBaseUrl' is never assigned to, and will always have its default value null
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\EventBubblingComponent.razor(80,10,80,37): error CS0649: Field 'EventBubblingComponent.intermediateStopPropagation' is never assigned to, and will always have its default value false
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\EventBubblingComponent.razor(82,10,82,32): error CS0649: Field 'EventBubblingComponent.ancestorPreventDefault' is never assigned to, and will always have its default value false
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\CascadingValueTest\CascadingValueSupplier.razor(26,10,26,27): error CS0649: Field 'CascadingValueSupplier.currentFlagValue2' is never assigned to, and will always have its default value false
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\RouterTest\PreventDefaultCases.razor(36,10,36,30): error CS0649: Field 'PreventDefaultCases.targetPreventDefault' is never assigned to, and will always have its default value false
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\CascadingValueTest\CascadingValueSupplier.razor(25,10,25,27): error CS0649: Field 'CascadingValueSupplier.currentFlagValue1' is never assigned to, and will always have its default value false
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\RouterTest\PreventDefaultCases.razor(37,10,37,34): error CS0649: Field 'PreventDefaultCases.descendantPreventDefault' is never assigned to, and will always have its default value false
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\DynamicComponentRendering.razor(31,20,31,35): error CS0649: Field 'DynamicComponentRendering.currentCaseName' is never assigned to, and will always have its default value null
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\SignalRClientComponent.razor(30,20,30,26): error CS0649: Field 'SignalRClientComponent.hubUrl' is never assigned to, and will always have its default value null
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\EventCustomArgsComponent.razor(79,10,79,37): error CS0649: Field 'EventCustomArgsComponent.customKeyDownPreventDefault' is never assigned to, and will always have its default value false
2>C:\dir\aspnetcore\src\Components\test\testassets\BasicTestApp\RouterTest\PreventDefaultCases.razor(35,10,35,32): error CS0649: Field 'PreventDefaultCases.ancestorPreventDefault' is never assigned to, and will always have its default value false
2>Done building project "BasicTestApp.csproj" -- FAILED.
========== Build: 1 succeeded, 1 failed, 6 up-to-date, 0 skipped ==========
This happens in other sample projects too if I add a [Parameter] property.
I’m unsure why this would only affect building inside VS and not the command line. Might it be something to do with source generator changes? I tried the following VS versions:
- 16.10.0 Preview 1.0
- 16.10.0 Preview 2.0 [31117.304.main]
… with the same results on both.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 3
- Comments: 15 (15 by maintainers)
Update: I’ve added a way to support override the
_UseRazorSourceGeneratorflag and falling back to the old model. When we pick up the next version of the SDK, I’ll disable the RSG for this project until we replat on the new source generators API.