question

JonathanFeucht-5255 avatar image
1 Vote"
JonathanFeucht-5255 asked acekwokse answered

Identity scaffolding in .net core 6.0 gives error message "Length cannot be less than zero."

Hello,

I've been trying to scaffold various Identity pages, however I keep getting an error dialog which says "There was an error running the selected code generator: 'Length cannot be less than zero. (Parameter 'length')'". 221876-param-length-zero.png.

In the code generation log, it gives a stack trace:

 Finding the generator 'identity'...
 Running the generator 'identity'...
 Length cannot be less than zero. (Parameter 'length')
    at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.<BuildCommandLine>b__6_0()
    at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
    at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.Execute(String[] args)
    at Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)

I'm running version 6.0.7 for the CodeGeneration package.

221699-nuget-packages.png

So is this a bug with the CodeGeneration package? Is there something else I should probably look into for debugging this? How can I get more information for the cause of this error dialog?


dotnet-aspnet-core-mvc
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

You have a lot going in this project. Several different DB providers, Identity Server, SPA services, etc.

Perhaps try creating an MVC project with the Individual user account option then scaffold Identity.

0 Votes 0 ·
MarcoA-9583 avatar image
0 Votes"
MarcoA-9583 answered MarcoA-9583 edited

I have the same situation. in asp.net 6 application
I used class program with Main in the program.cs file
"...
public class Program
{


 [Obsolete]
 public static void Main()  //string[] args
 {

.."

I have seen that in new projects the program.cs file does not contain the class program and the Main.
It may have some connection?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AlexanderMalyshkin-0726 avatar image
0 Votes"
AlexanderMalyshkin-0726 answered

I have the same issue! 228977-scaffolding-issue.png



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AtifHusain-5511 avatar image
0 Votes"
AtifHusain-5511 answered AtifHusain-5511 published

Hi, I have the exact same issue. It comes on Visual Studios for Mac... it works find when done from scratch in Visual Studio on windows even in .NET 6.

Anyone was able to find a solution?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

acekwokse avatar image
0 Votes"
acekwokse answered

After updating all nuget packages, errors were gone and was able to scaffold was able to generate all Identity files. Hope this helps.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.