Azure / Azure/autorest.powershell

Compilation error If query parameter is list of non nullable type

Open
#291 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C#
Stars
123
Forks
99
PR merge metrics
No merged PRs in 30d

Description

A parameter with the following decleration will result in generated code that cannot compile.

```
{
"name": "actionScope",
"in": "query",
"description": "If the log should be scoped to the provided action ids",
"required": false,
"items": {
"type": "integer",
"format": "int64"
},
"collectionFormat": "multi",
"type": "array"
}
```

Error: CS0023: Operator '?' cannot be applied to operand of type 'int'.

Generated code line:

```
var _url = new global::System.Uri((
""
+ "?"
+ (null != actionScope && actionScope.Length > 0 ? "actionScope=" + global::System.Uri.EscapeDataString(global::System.Linq.Enumerable.Aggregate(actionScope, (current, each) => current + "," + ( System.Uri.EscapeDataString(each?.ToString()??global::System.String.Empty) ))) : global::System.String.Empty)
).TrimEnd('?','&'));
```
Guess it is this badboy that breaks everthing: `each?.`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.