KeyNotFoundException: The given key was not present in the dictionary.
See original GitHub issueHi Guys,
Today we’ve got the following exception:
AutoRest code generation utility [version: 2.0.4413; node: v12.14.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Loading AutoRest core 'C:\Users\yahor_si\.autorest\@microsoft.azure_autorest-core@2.0.4413\node_modules\@microsoft.azure\autorest-core\dist' (2.0.4413)
Loading AutoRest extension '@microsoft.azure/autorest.typescript' (~4.2.0->4.2.4)
Loading AutoRest extension '@microsoft.azure/autorest.modeler' (2.3.51->2.3.51)
FATAL: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at AutoRest.Modeler.SwaggerModeler.Build(ServiceDefinition serviceDefinition) in c:\publish\autorest.modeler\src\SwaggerModeler.cs:line 142
at AutoRest.Modeler.Program.<ProcessInternal>d__2.MoveNext() in c:\publish\autorest.modeler\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: typescript/imodeler1 - FAILED
FATAL: Error: Plugin imodeler1 reported failure.
Process() cancelled due to exception : Plugin imodeler1 reported failure.
Error: Plugin imodeler1 reported failure.
The command line we use looks like this
$SwaggerSpec = "src/app/Api/TeamGateApiSwaggerSpec.json"
$OutputFolder = "."
$SecureSourceFolder = "src/app/Api/Secure"
$UnsecureSourceFolder = "src/app/Api/Unsecure"
# Generate Client with Auth support
autorest --add-credentials --source-code-folder-path=${SecureSourceFolder} --override-client-name=TeamGateApiSecured --input-file=${SwaggerSpec} --typescript --output-folder=${OutputFolder}
And swagger spec is attached in the zip TeamGateApiSwaggerSpec.zip
Any ideas on how we could fix it are really welcome! Thanks!
PS: And of course thank you for the cool tool! PPS: Sorry if that is a wrong repo for this issue
Issue Analytics
- State:
- Created 4 years ago
- Comments:16 (12 by maintainers)
Top Results From Across the Web
The given key was not present in the dictionary. Which key?
This exception is thrown when you try to index to something that isn't there, for example: Dictionary<String, String> test = new ...
Read more >KeyNotFoundException: The given key was not present in the ...
This problem tends to happen if you are initially populating the dictionary from a database query (or some other external data source), and ......
Read more >C# KeyNotFoundException: Key Not Present in Dictionary
KeyNotFoundException. In a C# program, a KeyNotFoundException was thrown. This is likely caused by a lookup done on a key (one that is...
Read more >The given key was not present in the dictionary. - Unity Forum
Hello, i like to have a way to find out what key was not found and write it to a logfile when i...
Read more >The given key was not present in the dictionary - CodeProject
Hi, Actually this exception occur when you are accessing Dictionary for Incorrect value. Here i have created one code snippet for ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you use NSwag, you can do something like:
SimplifyAllOfPropertiesProcessor.cs
Startup.cs
@fearthecowboy Here’s swashbuckle author explains rationale behind this (I resolved my own issue using advice from this thread, just wanted to add this as a reference).