microsoft / microsoft/kiota

kiota crashes with NullReferenceException after update

Open
#6,035 19 comments 0 reactions 0 assignees View on GitHub
Csharp fixed Needs: Attention :wave: type:bug
Dominant language
C#
Stars
3.8k
Forks
333
Avg merge
16h 29m
Merged PRs (30d)
116

Description

### What are you generating using Kiota, clients or plugins?

API Client/SDK

### In what context or format are you using Kiota?

Nuget tool

### Client library/SDK language

Csharp

### Describe the bug

After update from v1.21.0 to v1.22.3, kiota crashes with the following error on Ubuntu:

```
crit: Kiota.Builder.KiotaBuilder[0]
error generating the client: One or more errors occurred. (Object reference not set to an instance of an object.) (Object reference not set to an instance of an object.)
```

### Expected behavior

No crash.

### How to reproduce

Run the following command:
```
dotnet kiota generate --language CSharp --class-name RestrictedControllersClient --namespace-name OpenApiKiotaEndToEndTests.RestrictedControllers.GeneratedCode --output ./GeneratedCode --backing-store --exclude-backward-compatible --clean-output --clear-cache --log-level Error --openapi ./swagger.g.json
```

### Open API description file

Contents of swagger.g.json:

https://github.com/json-api-dotnet/JsonApiDotNetCore/blob/2212fc2c685446bebf86c905814a014f1a521cbd/test/OpenApiTests/RestrictedControllers/GeneratedSwagger/swagger.g.json

### Kiota Version

1.22.3

### Latest Kiota version known to work for scenario above?(Not required)

1.21.0

### Known Workarounds

None

### Configuration

Ubuntu 24.04.1 LTS (GitHub Actions runner)

### Debug output

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by running the reported dotnet kiota generate command on Ubuntu with the linked swagger.g.json, comparing Kiota 1.21.0 and 1.22.3 to confirm the regression. Trace the generation failure from the reported NullReferenceException and use the supplied OpenAPI description to isolate the triggering input. Done means the command completes without crashing and generates the client.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, openapi
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.