question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem for generating C# client: "System.NotSupportedException: Collection format None is not supported.

See original GitHub issue

Hello guys, I met a problem in order to generate a client thanks to autorest… Actually, I have correct swagger json definition (validated on online swagger editor -> 2.0.0) BUT An error is raised:

[14:26:57] Network Enabled: true
[14:26:58] The most recent installed version is 2.0.4168
[14:26:58] latest was not satisfied directly by a previous installation.
[14:26:58] Selected package: @microsoft.azure/autorest-core@2.0.4168 => ^2.0.4166
[14:26:58] AutoRest Core 2.0.4168 is available at C:\Users\lbabin\.autorest\@microsoft.azure_autorest-core@2.0.4168\node
_modules\@microsoft.azure\autorest-core
[14:26:58] Starting @microsoft.azure/autorest-core from C:\Users\lbabin\.autorest\@microsoft.azure_autorest-core@2.0.416
8
[14:26:58] Using core from: "C:\Users\lbabin\.autorest\@microsoft.azure_autorest-core@2.0.4168\node_modules\@microsoft.a
zure\autorest-core"
WARNING: The parameter --debug looks like it was meant for the new CLI! Note that you have invoked the legacy CLI (by us
ing at least one single-dash argument). Please visit https://github.com/Azure/autorest/blob/master/docs/user/cli.md for
information about the new CLI.
WARNING: The parameter --allow-no-input looks like it was meant for the new CLI! Note that you have invoked the legacy C
LI (by using at least one single-dash argument). Please visit https://github.com/Azure/autorest/blob/master/docs/user/cl
i.md for information about the new CLI.
FATAL: System.NotSupportedException: Collection format None is not supported.
   at AutoRest.CSharp.ClientModelExtensions.GetSeparator(CollectionFormat format) in C:\Users\ci\AppData\Local\Temp\PUBL
ISHv6236\30_20171011T220809\autorest.csharp\src\vanilla\ClientModelExtensions.cs:line 235
   at AutoRest.CSharp.ClientModelExtensions.GetFormattedReferenceValue(Parameter parameter, String clientReference) in C
:\Users\ci\AppData\Local\Temp\PUBLISHv6236\30_20171011T220809\autorest.csharp\src\vanilla\ClientModelExtensions.cs:line
210
   at AutoRest.CSharp.Model.MethodCs.BuildUrl(String variableName) in C:\Users\ci\AppData\Local\Temp\PUBLISHv6236\30_201
71011T220809\autorest.csharp\src\vanilla\Model\MethodCs.cs:line 389
   at AutoRest.CSharp.vanilla.Templates.Rest.Client.MethodTemplate.<ExecuteAsync>d1.MoveNext() in C:\Users\ci\AppData\Lo
cal\Temp\PUBLISHv6236\30_20171011T220809\autorest.csharp\src\obj\Razor\vanilla\Templates\Rest\Client\MethodTemplate.csht
ml:line 120
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at AutoRest.Core.Template"1.ToString()
   at AutoRest.CSharp.vanilla.Templates.Rest.Client.ServiceClientTemplate.<ExecuteAsync>d1.MoveNext() in C:\Users\ci\App
Data\Local\Temp\PUBLISHv6236\30_20171011T220809\autorest.csharp\src\obj\Razor\vanilla\Templates\Rest\Client\ServiceClien
tTemplate.cshtml:line 101
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at AutoRest.Core.CodeGenerator.<Write>d12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at AutoRest.CSharp.CodeGeneratorCs.<GenerateClientSideCode>d8.MoveNext() in C:\Users\ci\AppData\Local\Temp\PUBLISHv62
36\30_20171011T220809\autorest.csharp\src\vanilla\CodeGeneratorCs.cs:line 60
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at AutoRest.CSharp.CodeGeneratorCs.<GenerateRestCode>d9.MoveNext() in C:\Users\ci\AppData\Local\Temp\PUBLISHv6236\30_
20171011T220809\autorest.csharp\src\vanilla\CodeGeneratorCs.cs:line 124
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at AutoRest.CSharp.CodeGeneratorCs.<Generate>d10.MoveNext() in C:\Users\ci\AppData\Local\Temp\PUBLISHv6236\30_2017101
1T220809\autorest.csharp\src\vanilla\CodeGeneratorCs.cs:line 157
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at AutoRest.CSharp.Program.<ProcessInternal>d4.MoveNext() in C:\Users\ci\AppData\Local\Temp\PUBLISHv6236\30_20171011T
220809\autorest.csharp\src\Program.cs:line 147
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NewPlugin.<Process>d15.MoveNext()
FATAL: csharp/generate - FAILED
FATAL: Error: Plugin csharp reported failure.
Process() Cancelled due to exception : Plugin csharp reported failure.
Error: Plugin csharp reported failure.
    at CreatePluginExternal (C:\Users\lbabin\.autorest\@microsoft.azure_autorest-core@2.0.4168\node_modules\@microsoft.a
zure\autorest-core\dist\lib\pipeline\pipeline.js:91: 19)
    at <anonymous>
PS D:\ITESSO\Grammar\Json\Booking>

As you can see the problem is : “System.NotSupportedException: Collection format None is not supported.”. Do you have an idea? Thanks for your time 😃

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
fearthecowboycommented, Oct 27, 2017

The issue is that if you specify the query parameter as type:array, you have to tell autorest how the items are formatted. Add "collectionFormat": "csv" to the parameter definition.

Hmm. according to https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameter-objectcsv is the default. Clearly, that’s not what we’re doing.

That’s a bug!

(still, add the "collectionFormat": "csv" to the parameter definition to work around it)

0reactions
MiYannicommented, Nov 7, 2019

Workaround provided. Closing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does Visual Studio 2017 fail to generate REST API client ...
[Fatal]Error generating client model: Collection format "multi" is not supported (in parameter 'status').
Read more >
NotSupportedException Class (System) - Microsoft Learn
The NotSupportedException exception indicates that a method has no implementation and that you should not call it. You should not handle the exception....
Read more >
Getting System.NotSupportedException: Not supported within ...
Hello: I am getting this exception: System.NotSupportedException: Not supported within subreports. at CrystalDecisions.ReportAppServer.
Read more >
415 Unsupported Media Type - HTTP - MDN Web Docs
The HTTP 415 Unsupported Media Type client error response code indicates ... the request because the payload format is in an unsupported format....
Read more >
couchbase.exceptions — Couchbase Python Client Library 3.0.6 ...
_libcouchbase as C from typing import * import json import sys import inspect ... string import Template from collections import defaultdict from functools ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found