dotnet / dotnet/Scaffolding

Got error while scaffolding minimal API with separate data layer solution. ('startIndex cannot be larger than length of string. (Parameter 'startIndex')')

Open
#2,543 1 comment 0 reactions 0 assignees View on GitHub
area-scaffolding customer-reported
Dominant language
C#
Stars
818
Forks
260
Avg merge
1d 8h
Merged PRs (30d)
10

Description

While I learning to coding on minimal API with .Net 7.0 (runtime version 7.0.11) I got stuck with scaffolding a endpoint for minimal api.

I got error
``` There was an error running the selected code generator: 'startIndex cannot be larger than length of string. (Parameter 'startIndex')' ```

![image](https://github.com/dotnet/Scaffolding/assets/110652592/3be7d3cf-724a-4282-a26d-c43f3f7542fe)

While I scaffolding a Minimal API wtih DbContext that on another reference solution , selecting "API with read/write endpoints, using Entity Framework" option on scaffolding menu

![image](https://github.com/dotnet/Scaffolding/assets/110652592/ee6dcf6d-08a2-4f3a-9cd2-06ce97912dd0)

All dependencies is up to date (7.0.11 except CodeGeneration that latest version is 7.0.10)
here a image of dependencies of each solution

**dependencies of API Solution**
![image](https://github.com/dotnet/Scaffolding/assets/110652592/0cd02ffe-0e5a-48c1-bbff-f7907637e9e0)

**dependencies of Data layer Solution**
![image](https://github.com/dotnet/Scaffolding/assets/110652592/c75a4b90-f4d5-45be-b063-d4036d45af9c)

**Here is my SDKs and Runtimes that has been installed in my computer**
![image](https://github.com/dotnet/Scaffolding/assets/110652592/33121b41-8ef2-48a8-907e-1a458df6e7f6)

if you want any more information on my machine please tell me.

Thank you.

Contributor guide

Open the contributing guide

Research direction

Reproduce the reported Visual Studio scaffolding flow for a .NET 7 minimal API with a separate data-layer solution, selecting "API with read/write endpoints, using Entity Framework." No source file or test is named; investigate the generator path that produces the startIndex exception, and consider the issue done when the failing setup is explained and the scaffolding flow no longer errors or reports a clear validation failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.