Compile fails with cannot convert from 'ConflictingName.Model' to 'BlazorTypeBug.ConflictingName.Model' #25246
Labels
area-blazor
Includes: Blazor, Razor Components
✔️ Resolution: Duplicate
Resolved as a duplicate of another issue
Status: Resolved
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
Parent components fails to generate the correct code for setting a property in child components when the type of property requires global:: qualifier.
The Razor compiler generates the following code:
The component being compiled is in the namespace
BlazorTypeBug.ConflictingName.Components
, so the generic parameter in the call to TypeCheck is being assumed to be in the namespaceBlazorTypeBug.ConflictingName
rather than the top-levelConflictingName
namespace.Here the call to TypeCheck, should have a fully qualified namespace, including the global qualifier:
global::ConflictingName.Model
instead ofConflictingName.Model
To Reproduce
Checkout this repo and try to compile. https://github.com/diegofrata/BlazorTypeBug
Exceptions (if any)
ParentComponent.razor.g.cs(25, 137): [CS0234] The type or namespace name 'Model' does not exist in the namespace 'BlazorTypeBug.ConflictingName' (are you missing an assembly reference?)
ParentComponent.razor(4, 24): [CS1503] Argument 1: cannot convert from 'ConflictingName.Model' to 'BlazorTypeBug.ConflictingName.Model'
Further technical details
The text was updated successfully, but these errors were encountered: