Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

csharp CodeGen should provide clear message for self-service trouble shooting #5508

Open
3 tasks done
lirenhe opened this issue Jan 7, 2025 · 0 comments
Open
3 tasks done
Labels
emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp

Comments

@lirenhe
Copy link
Member

lirenhe commented Jan 7, 2025

Clear and concise description of the problem

We need to empower our customers both internal and external to easily trouble shooting and fix spec issues that would block the CodeGen.
If certain TypeSpec features or patterns are not supported by CodeGen, we should clearly point it out and suggest them to update the spec with the features we supported for CodeGen.

Today, csharp CodeGen just returned a big call-stack like below which could not help for self-service resolving the problem.

Unhandled exception. System.NotSupportedException: BinaryData
     at AutoRest.CSharp.Generation.Types.CSharpType.GetElementType() in D:\a\_work\1\s\autorest.csharp\src\AutoRest.CSharp\Common\Generat
  ion\Types\CSharpType.cs:line 336
     at AutoRest.CSharp.Generation.Types.CSharpType.get_ElementType() in D:\a\_work\1\s\autorest.csharp\src\AutoRest.CSharp\Common\Genera
  tion\Types\CSharpType.cs:line 224
     at AutoRest.CSharp.Output.Builders.SerializationBuilder.BuildJsonSerialization(InputType inputType, CSharpType valueType, Boolean is
  CollectionElement, SerializationFormat serializationFormat) in D:\a\_work\1\s\autorest.csharp\src\AutoRest.CSharp\Common\Output\Builder
  s\SerializationBuilder.cs:line 162
     at AutoRest.CSharp.Output.Builders.SerializationBuilder.BuildJsonSerialization(InputType inputType, CSharpType valueType, Boolean is
  CollectionElement) in D:\a\_work\1\s\autorest.csharp\src\AutoRest.CSharp\Common\Output\Builders\SerializationBuilder.cs:line 172
     at AutoRest.CSharp.Output.Builders.SerializationBuilder.CreateJsonPropertySerializationFromInputModelProperty(SerializableObjectType
   objectType, ObjectTypeProperty property, TypeFactory typeFactory) in D:\a\_work\1\s\autorest.csharp\src\AutoRest.CSharp\Common\Output\
  Builders\SerializationBuilder.cs:line 291
     at AutoRest.CSharp.Output.Builders.SerializationBuilder.<>c__DisplayClass16_0.b__0(ObjectTypeProperty p)
  in D:\a\_work\1\s\autorest.csharp\src\AutoRest.CSharp\Common\Output\Builders\SerializationBuilder.cs:line 441
     at AutoRest.CSharp.Output.Builders.SerializationBuilder.GetPropertySerializationsFromBag[T](PropertyBag`1 propertyBag, Func`2 jsonPr
  opertySerializationFactory)+MoveNext() in D:\a\_work\1\s\autorest.csharp\src\AutoRest.CSharp\Common\Output\Builders\SerializationBuilde
  r.cs:line 331

Expected behavior:

I suggest we could improve the following areas:

  1. Leverage TypeSpec diagnostics APIs to report the errors and provide more context so that users could easily identify the TypeSpec source that cause the error..
  2. Provide a clear message for the unsupported scenarios and ideally provide some suggestions on how to fix.

workstream this request is associated with

This is related to the TypeSpec E2E scenario and ensure service team/customer to self service trouble shooting the problem

stakeholders

@lmazuel / @lirenhe

priority and timeline.

I suggest we should provide a better experience for self-service trouble shooting as part of the TypeSpec GA.

Checklist

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
@lirenhe lirenhe added the emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp label Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp
Projects
None yet
Development

No branches or pull requests

1 participant