microsoft / typespec

https://typespec.io/
MIT License
4.45k stars 208 forks source link

[Bug]: http-client-csharp: crashed on operation #4459

Open Arithmomaniac opened 1 month ago

Arithmomaniac commented 1 month ago

Describe the bug

When attempting to run (see reproduction steps) just to see what the output would look like, I got the attached error, which contains the text

Emitter "@typespec/http-client-csharp" crashed! This is a bug.
Please file an issue at https://github.com/Microsoft/typespec/issues

errorMessage.txt

Reproduction

  1. clone/download https://github.com/microsofthackathons/TypespecForSefaria/tree/7035cd21b9daf02c256c4c80e25c764d06fce9de. Navigate to tsp.
  2. run npm install @typespec/http-client-csharp.
  3. run tsp compile .. OpenAPI output succeeds; it's valid TypeSpec.
  4. run tsp compile . --emit @typespec/http-client-csharp. Attached crash occurs.

Checklist

JoshLove-msft commented 5 days ago

Root element is missing. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res) at System.Xml.XmlTextReaderImpl.ParseDocumentContent() at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r) at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options) at System.Xml.Linq.XDocument.Parse(String text, LoadOptions options) at Microsoft.Generator.CSharp.ReferenceMapBuilder.ProcessPropertySymbol(INamedTypeSymbol keySymbol, IPropertySymbol propertySymbol, ReferenceMap referenceMap) in /mnt/vss/_work/1/s/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/PostProcessing/ReferenceMapBuilder.cs:line 244 at Microsoft.Generator.CSharp.ReferenceMapBuilder.ProcessPublicSymbolAsync(INamedTypeSymbol symbol, ReferenceMap referenceMap, IReadOnlyDictionary2 cache) in /mnt/vss/_work/1/s/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/PostProcessing/ReferenceMapBuilder.cs:line 81 at Microsoft.Generator.CSharp.ReferenceMapBuilder.BuildPublicReferenceMapAsync(IEnumerable1 definitions, IReadOnlyDictionary`2 nodeCache) in /mnt/vss/_work/1/s/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/PostProcessing/ReferenceMapBuilder.cs:line 32 at Microsoft.Generator.CSharp.PostProcessor.InternalizeAsync(Project project) in /mnt/vss/_work/1/s/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/PostProcessing/PostProcessor.cs:line 123 at Microsoft.Generator.CSharp.GeneratedCodeWorkspace.PostProcessAsync() in /mnt/vss/_work/1/s/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/PostProcessing/GeneratedCodeWorkspace.cs:line 238 at Microsoft.Generator.CSharp.CSharpGen.ExecuteAsync() in /mnt/vss/_work/1/s/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/CSharpGen.cs:line 65 at Microsoft.Generator.CSharp.GeneratorRunner.RunAsync(CommandLineOptions options) in /mnt/vss/_work/1/s/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/StartUp/GeneratorRunner.cs:line 16 at Microsoft.Generator.CSharp.Program.Run(CommandLineOptions options, GeneratorRunner runner) in /mnt/vss/_work/1/s/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/StartUp/Program.cs:line 41 Emitter "@typespec/http-client-csharp" crashed! This is a bug.