Azure / autorest.csharp

Extension for AutoRest (https://github.com/Azure/autorest) that generates C# code
MIT License
142 stars 166 forks source link

NRE in AutoRest.Modeler 2.3.55 Model.RequestBody.AsParameters #169

Closed ctaggart closed 1 year ago

ctaggart commented 5 years ago
PS C:\Users\taggac\coreservices\RegisterDeadboltClients> autorest --input-file=..\deadbolt\swagger.yml --csharp
AutoRest code generation utility [version: 2.0.4283; node: v10.10.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
   Loading AutoRest core      'C:\Users\taggac\.autorest\@microsoft.azure_autorest-core@2.0.4289\node_modules\@microsoft.azure\autorest-core\dist' (2.0.4289)
   Loading AutoRest extension '@microsoft.azure/autorest.csharp' (~2.3.79->2.3.82)
   Loading AutoRest extension '@microsoft.azure/autorest.modeler' (2.3.55->2.3.55)
FATAL: System.ArgumentNullException: Value cannot be null.
Parameter name: source
   at System.Linq.Enumerable.Select[TSource,TResult](IEnumerable1 source, Func2 selector)
   at AutoRest.Modeler.Model.RequestBody.AsParameters() in /opt/vsts/work/1/s/src/Model/RequestBody.cs:line 38
   at AutoRest.Modeler.Model.Operation.get_Parameters() in /opt/vsts/work/1/s/src/Model/Operation.cs:line 90
   at AutoRest.Modeler.OperationBuilder.BuildMethodParameters(Method method) in /opt/vsts/work/1/s/src/OperationBuilder.cs:line 253
   at AutoRest.Modeler.OperationBuilder.BuildMethod(HttpMethod httpMethod, String url, String methodName, String methodGroup) in /opt/vsts/work/1/s/src/OperationBuilder.cs:line 100
   at AutoRest.Modeler.SwaggerModeler.BuildMethod(HttpMethod httpMethod, String url, String name, Operation operation) in /opt/vsts/work/1/s/src/SwaggerModeler.cs:line 404
   at AutoRest.Modeler.SwaggerModeler.Build(ServiceDefinition serviceDefinition) in /opt/vsts/work/1/s/src/SwaggerModeler.cs:line 106
   at AutoRest.Modeler.Program.<ProcessInternal>d__2.MoveNext() in /opt/vsts/work/1/s/src/Program.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 NewPlugin.<Process>d__15.MoveNext()
FATAL: csharp/imodeler1 - FAILED
FATAL: Error: Plugin imodeler1 reported failure.
Process() cancelled due to exception : Plugin imodeler1 reported failure.
  Error: Plugin imodeler1 reported failure.

Now I just need to figure out how to diagnose and fix it...

kant2002 commented 5 years ago

I have exactly the same issue when running using autorest@beta on the pet api

I have issue when responseBody object contains schema reference or content contains reference to schema object. I manage to provide workaround in the PR to solve resolving issue in the content data.

Resolving schema for the responseBody require a little more work, since presently does not exists ResponseBody cache.

avezenkov commented 4 years ago

I have same issue and don't have any clue what is causing it.