Open ryanelian opened 4 years ago
OK, found the reason for this brainfuckery.
In hindsight, I was asking for this trouble because the component full class path with namespace is FluentValidation.FluentValidator
but the project name is Accelist.FluentValidation.Blazor
so that's partially my fault. (Republished the package with different namespace)
On the other side apparently, Blazor Class Library generates classes with namespace = the project name silently, which causes this trouble in the first place:
What apparently happened (if I'm not mistaken, CMIIW) is that because THAT mysterious _Imports
class exists, <FluentValidation.FluentValidator>
is treated as Accelist.FluentValidation.FluentValidator
in Accelist.SomeProject
project namespace. (Ouch...)
However, Blazor .razor
designer is blissfully unaware of this mindfuckery, so it happily highlights <FluentValidation.FluentValidator>
in the VS IDE without squiggly reds.
However, when the .razor
gets compiled as C#, all hell broke loose because FluentValidation.FluentValidator
is treated as Accelist.FluentValidation.FluentValidator
for some reason. (EVEN WHEN @using FluentValidation
is added to _Imports.razor
AND <FluentValidator>
is used!)
TL;DR Razor post-compilation C# has bug during namespace resolution.
@NTaylorMullen the issue here is this and below:
However, Blazor .razor designer is blissfully unaware of this mindfuckery, so it happily highlights
in the VS IDE without squiggly reds.
@ryanelian We've made a significant amount of component and diagnostic improvements in VS2022. Can you confirm whether this issue still repros for you?
Describe the bug
This is the offending library: https://github.com/ryanelian/FluentValidation.Blazor
I failed to compile the project with namespace:
Accelist.SomethingSomething
whenever I use the component in my main (closed source) app project. Like, this file appears with that error:As you can see, the component is actually visible in the IDE:
However, my other demo project with the same exact library used builds just fine. (huh) https://github.com/ryanelian/accelist-tech-day-blazor
To Reproduce
Try using the library somewhat in a project. Or simply try compiling the demo project and see if it fails.EDIT: Try using the library version 1.4.0 in a project with
Accelist.Something
namespace. 😄Further technical details
dotnet --info