Adding Blazor Identity to existing Blazer project fails with a 'null path' exception
Hi!
I have the following:
- .Net SDK 9
- Visual Studio Community 2022 v 17.12.3
- Windows v10.0.19044
- Blazer Server App
When I try to add the Blazor Identity "scaffolding" I get a "There was an error running the selected code generator: 'Value cannot be null. (Parameter 'path'). I can see that some of the EF-framework assemblies and SQLite-engine was installed but nothing else. Is there a solution to this?
Cheers
Blazor
Visual Studio
-
Tiny Wang-MSFT • 3,066 Reputation points • Microsoft Vendor
2024-12-18T12:43:11.2466667+00:00 Hi kodu, per my knowledge, Blazor Server App exists in .Net version before .Net 8, so that .Net 9 doesn't have Blazor Server App, may I know whether Blazor Server here mean Blazor web app which is a new template from .Net 8?
-
kodo65 • 5 Reputation points
2024-12-18T13:03:48.1633333+00:00 I'm using Blazor web app - sorry for the confusion.
-
Tianyu Sun-MSFT • 32,531 Reputation points • Microsoft Vendor
2024-12-18T13:43:50.2+00:00 Hi @kodo65,
I tested with Blazor web app, .NET 9 and VS 2022 v17.12.3, but I failed to reproduce this issue.
I show you the steps I followed, kindly let me know if I missed some steps when I tried to reproduce this issue.
Create a .NET 9 Blazor web app, right-click it => Add => New Scaffolded Item... => pick Blazor Identity => click Add, select DbContext class(I added a new data context type), select Database provider(SQL Server) => click Add.
BTW, if you can share us the complete steps to reproduce this issue and check further, it will be very helpful.
I also find a similar thread(state: "Fixed - pending release"): Scaffolding Identity to a web project fails to complete with an error message of "Value cannot be null. (Parameter 'objectToConvert')". Maybe, it's not the same issue, but once the next version of VS 2022 has been released, I think you can also try to update VS 2022 to the latest version.
-
kodo65 • 5 Reputation points
2024-12-18T14:07:56.0233333+00:00 I performed exactly the same steps as you with the exception I selected SQLite as I want this to be a bundled solution without relying on the SQLServer (Windows) service. The target system will be run on Linux which means I need to keep the dependencies in Windows components to a minimum. I thought that relying on SQLite would make my solution "more cross platform". Is this correct?
-
Bruce (SqlWork.com) • 70,376 Reputation points
2024-12-18T17:13:07.4633333+00:00 as SQLite is an in process database, it will not work on a webfarm, just single sever.
note: I added Blazor identity with sqlite with no issues:
Microsoft Visual Studio Professional 2022 (64-bit) - Preview Version 17.13.0 Preview 2.0
-
kodo65 • 5 Reputation points
2024-12-19T07:48:58.23+00:00 Hi!
In-process is no problem to me as I'll run my app as a docker compose stack on Linux. It's encouraging to hear you didn't experience any problems using the identity scaffolding - unfortunately it doesn't work for me though. Maybe the problem is that I use community version and not a preview...?
Cheers
-
Tianyu Sun-MSFT • 32,531 Reputation points • Microsoft Vendor
2024-12-20T06:16:12.78+00:00 Hi @kodo65 ,
I'm using Community version as well, I also fail to reproduce this issue.
May I confirm, if you added the Blazor Identity to an existing Blazor project or, a newly created Blazor project without modifying anything?
If it's an existing Blazor project, will it work if you delete the bin, obj and the hidden .vs folder in your project/solution folder?
If it's a newly created Blazor project, will it work if you repair VS(VS Installer => More => Repair)?
-
Tianyu Sun-MSFT • 32,531 Reputation points • Microsoft Vendor
2024-12-25T08:20:56.4333333+00:00 @kodo65 ,
Do you still meet this issue? If a repair(VS) doesn't work, perhaps you can try to reinstall the "ASP.NET and web development" workload.
Besides, will it work if you run VS as administrator?
-
Timo Schneider • 0 Reputation points
2025-01-23T12:08:12.58+00:00 I have unfortunately the exact same problem. It concerns an existing application. As mentioned in the other comment, I also deleted the folders. Unfortunately, this did not change the situation. When I look at the output during scaffolding, the error always occurs at… (see image)
-
AgaveJoe • 29,681 Reputation points
2025-01-23T17:52:56.9166667+00:00 When I look at the output during scaffolding, the error always occurs at… (see image)
You did not include the image. If you are getting the same path error and you are using SQLite, make sure you've set the path to the SQLite database in configuration.
https://learn.microsoft.com/en-us/dotnet/standard/data/sqlite/?tabs=net-cli
Also, we have no idea what kind of Blazor application you've got there or even if you are building a Blazor application. Keep in mind, the OP in this post was mistaken as .NET 9 does not have a template for the Blazer Server App.
-
kodo65 • 5 Reputation points
2025-01-27T09:16:36.58+00:00 Hi! Sorry missed to include the screen dump:
I have the following:
- Microsoft Visual Studio Community 2022 (64-bit) 17.12.3
- Blazor web app
- Target: .Net 9
- Windows 10 Enterprise LTSC. 21H2, 19044.5371
The steps I follow are:
After I click "Add" the tool performs various operations but the end result is the error shown above. However, there's an SQLite configuration added and opening that gives:
Making sure I have a "Data" folder in my project doesn't help! Exactly the same error keeps popping up.
I'm still stranded here :(
-
kodo65 • 5 Reputation points
2025-01-28T11:29:35.5666667+00:00 Hi! Sorry for the late reply - I've been away on vacation. I followed your recommendations and removed bin, obj and .vs folders and tried to add the identity scaffolding again but I still get exactly the same result - it fails with the 'Value cannot be null. (Parameter
path
)'. -
kodo65 • 5 Reputation points
2025-01-28T11:31:13.6166667+00:00 Hi! sorry for the late reply. I followed your recommendation and removed obj, bin and .vs folders but I atill get the same error: 'Value cannot be null (Parameter path)'.
Sign in to comment