Open mayur-ekbote opened 10 months ago
Misread - Blazor Server
Can you please elaborate? I am not sure what you mean by AdditionalAssemblies
Thank you for filing this issue. In order for us to investigate this issue, please provide a minimal repro project that illustrates the problem without unnecessary code. Please share with us in a public GitHub repo because we cannot open ZIP attachments, and don't include any confidential content.
@surayya-MS It is not possible to provide a repro:
Now, here is the kicker: I wanted to create a repro, but I did not see the .net 8 in the create new project wizard! (.net 8 is installed and is being used by VS for running the app.)
Also, this is not a new issue. Please see: #5001
Is there anyway to diagnose this? I remember encountering this problem a couple of years ago, but it was fixed.
@mayur-ekbote , could you please create a .net 7 Blazor Server app and then update to .net 8?
Here's what I tried:
<RazorClassLibrary1.Component1 />
to the Index pageIt seems to work fine:
I followed the 'create .net 7 -> upgrade to .net 8' path and the issues seems to be stemming from VS losing intellisense.
(Please refer to attached video for the remaining)
https://1drv.ms/v/s!Am6vW_yz2H5DhOMuAYtoelJ6hW-Kyw?e=5Y72sS
Ideally, IntelliSense should tell that TestComponent
is inside ReferenceLibrary.InnerComponent
. Not only does it not, but also doesn't recognize the component even after it is added and program is run.
In a project with many folder hierarchies, it is hard to know which inner folders have been referred to - since IntelliSense doesn't even see those namespaces.
However, the divergence in the behavior between VS preview and VS seems to have been fixed after the last release of VS.
However, the runtime seems to be working once the reference is added.
Do you mean it works fine when you run or if you build/run from the command-line?
Now upgrade both projects using Upgrade tool.
This might leave the projects in an unknown state. Does cleaning (physically removing) the bin/obj folders after this step makes the issue go away?
Do you mean it works fine when you run or if you build/run from the command-line?
After the last update, it works fine from VS too. However, the IDE does not recognize the component. The actual output on running the project is fine (check the ending of the video). Which is to say that the original problem doesn't arise.
This might leave the projects in an unknown state. Does cleaning (physically removing) the bin/obj folders after this step makes the issue go away?
In a small repro, it does go away. However, in my actual project, it doesn't. (See the screenshot). Basically, I end up coding blind since IntelliSense shows no hints - rather keeps saying if I want to create a new component from the tag. The actual application works as expected. I haven't checked with the additional CSS yet.
@mayur-ekbote thanks for the additional details.
It seems that this is tooling related, so I'll let them chime in here as they are the experts.
I know you said you removed the obj
folders everywhere, which is good, but it is surprising that this fixes the issue in a simple repro project, but not in your real project. I just tried the full repro in that version (new .NET 7 projects, upgrade assistant on both, add new folder and component etc.) and it worked fine, which seems to confirm your results too.
Is there anything in your real project that does any "fancy" msbuild things, like configuring the IntermediateOutputPath
, or even maybe opting in to the new artifacts layout? Are any of your projects multitargeting?
Would it be possible for you to list the file paths involved in your real project? It would be useful to get an idea of where the .sln
file is, where all of the .csproj
files are, their relationships to each other, etc. It would also be useful to get a list of all of the project.razor.vs.bin
files anywhere on the file system, inside your solution directory.
It sounds a lot like the issue would be fixed by https://github.com/dotnet/razor/pull/9601, which has just shipped in Visual Studio 17.9 Preview 2, however it also should have been fixed by cleaning out all of the obj
folders, so I can't be fully confident when I say that. If it is possible for you to try the new preview release, it would be very useful to know if the problem is fixed in that version.
I am not doing anything fancy. (multi targeting, intermediateoutputpath etc). I upgraded to Preview 2. The issue persists, IntelliSense doesn't see the components, it also doesn't see all the namespaces. Check the screenshot:
Thanks for the reply @mayur-ekbote, but unfortunately I'm not sure what the next steps here would be, if the issue only repros in your project, and not in a simple one.
Does the issue get fixed if you open one of the files that is missing from intellisense? Would it be possible for you to list the file paths involved in your real project? It would be useful to get an idea of where the .sln file is, where all of the .csproj files are, their relationships to each other, etc. It would also be useful to get a list of all of the project.razor.vs.bin files anywhere on the file system, inside your solution directory.
If you'd be willing, it would be most useful if you can zip up your project and email it to me (david.wengier at microsoft.com) so I could see if I can reproduce it on my machine, with the exact setup you have.
It is not possible to share the project (proprietary + large). However, I can share my desktop over a remote zoom/teams session. You can look through any project files you want to figure out the conditions that can reproduce the bug.
Any update on this? The latest VS updates don't fix this
@mayur-ekbote , let's work out a time to meet and share screens, you can contact me
Upon inspection of the csproj file, I saw that the following lines were added. I have no idea what triggered this addition and why this razor component was added (it doesn't happen with all malfunctioning razor components)
<ItemGroup>
<UpToDateCheckInput Remove="Pages\Instruction\Fragments\SymbolLabel.razor" />
</ItemGroup>
<ItemGroup>
<_ContentIncludedByDefault Remove="Pages\Instruction\Fragments\SymbolLabel.razor" />
</ItemGroup>
I'm creating a new Blazor Server app with components in a shared RCL. I noticed the designer was failing to recognize my components in the RCL, yet the application was running fine.
After deleting the bin and obj folders, the designer started recognizing the components in RCL correctly.
Then, I backed my RCL out of the solution and got the Blazor Server app to build and run stand alone again. After re-adding the RCL and referencing its components, this problem returns: I can run the Blazor Server app, but the designer has errors about missing classes for the shared components.
In summary, steps to reproduce seem to be:
And to fix:
I'm creating a new Blazor Server app with components in a shared RCL. I noticed the designer was failing to recognize my components in the RCL, yet the application was running fine.
@zacuke What version of Visual Studio are you using?
Microsoft Visual Studio Professional 2022 (64-bit) - Current Version 17.9.2
The projects both target .net 8
Output from dotnet --list-sdks: 6.0.419 [C:\Program Files\dotnet\sdk] 8.0.200 [C:\Program Files\dotnet\sdk]
Is there any update on this? I am unable to create debug points in the file. Not that I can't create debug points at all. But I can create debug points till a line in the file and then I can't! Check the video:
https://github.com/dotnet/razor/assets/40038634/e0fc263c-d54e-4447-bc56-79a98ac0d01b
@mayur-ekbote The issue you're describing does look like a bug, but it seems different from this one. I recommend opening a Visual Studio feedback ticket with detailed steps on how to reproduce the problem you are seeing.
Is there an existing issue for this?
Describe the bug
I recently updated to .net 8. I have both VS 2022 and 2022 Preview version installed.
That was for an existing component. Now, if I add any new component to the RCL, it is not recognized by either of these versions at all! If I create SomeComponent.razor and use it anywhere in the Blazor server project,
<SomeComponent />
gets rendered as<somecomponent/>
and obviously does appear on the page.I have tried:
Directory.Build.props
and addingNow, here is the kicker: I wanted to create a repro, but I did not see the .net 8 in the create new project wizard! (.net 8 is installed and is being used by VS for running the app.)
Is there anyway to diagnose this? I remember encountering this problem a couple of years ago, but it was fixed.
Expected Behavior
No response
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
8.0.100
Anything else?
No response