-
Notifications
You must be signed in to change notification settings - Fork 176
Closed
Labels
customer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Description
Using the ModelReaderWriter generation mode for Azure.Search.Documents hits a generator bug. This is blocking fixing some AOT warnings in azure-mcp. @JoshLove-msft @m-nash
System.ArgumentException: An item with the same key has already been added. Key: global::Azure.Search.Documents.Indexes.Models.KeywordTokenizer
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer1 comparer)
at AutoRest.CSharp.Common.Generation.Writers.ModelReaderWriterContextWriter.CollectBuildableTypes(IEnumerable`1 models) in D:\a\_work\1\s\autorest.csharp\src\AutoRest.CSharp\Common\Generation\Writers\ModelReaderWriterContextWriter.cs:line 91
at AutoRest.CSharp.Common.Generation.Writers.ModelReaderWriterContextWriter.Write(CodeWriter writer, IEnumerable`1 models) in D:\a\_work\1\s\autorest.csharp\src\AutoRest.CSharp\Common\Generation\Writers\ModelReaderWriterContextWriter.cs:line 28
at AutoRest.CSharp.AutoRest.Plugins.DataPlaneTarget.Execute(GeneratedCodeWorkspace project, InputNamespace inputNamespace, SourceInputModel sourceInputModel) in D:\a\_work\1\s\autorest.csharp\src\AutoRest.CSharp\DataPlane\AutoRest\DataPlaneTarget.cs:line 95
at AutoRest.CSharp.AutoRest.Plugins.CSharpGen.ExecuteAsync(CodeModel codeModel) in D:\a\_work\1\s\autorest.csharp\src\AutoRest.CSharp\Common\AutoRest\Plugins\CSharpGen.cs:line 39
at AutoRest.CSharp.AutoRest.Plugins.CSharpGen.Execute(IPluginCommunication autoRest) in D:\a\_work\1\s\autorest.csharp\src\AutoRest.CSharp\Common\AutoRest\Plugins\CSharpGen.cs:line 136
at AutoRest.CSharp.AutoRest.Plugins.PluginProcessor.Start(IPluginCommunication autoRest) in D:\a\_work\1\s\autorest.csharp\src\AutoRest.CSharp\Common\AutoRest\Plugins\PluginProcessor.cs:line 39
fatal | Process() cancelled due to failure
error | Error: Plugin csharpgen reported failure
Repro:
-
clone https://github.com/sbomer/azure-sdk-for-net/tree/aiSearchMRW
This branch is just main with
use-model-reader-writer: true
turned on in Azure.Search.Documents/src/autorest.md (and SDK roll-forward to make it easier to use a recent dotnet version)
-
dotnet build /t:GenerateCode sdk/search/Azure.Search.Documents/src/
This fails. Running the inner npx command shows the stacktrace above.
Metadata
Metadata
Assignees
Labels
customer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that