You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Repeating the same parameter name multiple times in the url template causes Refit to crash at runtime
Steps To Reproduce
The repeated zoneId parameter in the code below causes the generated Refit code to crash at runtime. The exception is: System.ArgumentException: An item with the same key has already been added.
Unhandled exception. System.ArgumentException: An item with the same key has already been added. Key: 0
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at Refit.RestMethodInfo.BuildParameterMap(String relativePath, List`1 parameterInfo) in /_/Refit/RestMethodInfo.cs:line 178
at Refit.RestMethodInfo..ctor(Type targetInterface, MethodInfo methodInfo, RefitSettings refitSettings) in /_/Refit/RestMethodInfo.cs:line 68
at Refit.RequestBuilderImplementation.AddInterfaceHttpMethods(Type interfaceType, Dictionary`2 methods) in /_/Refit/RequestBuilderImplementation.cs:line 76
at Refit.RequestBuilderImplementation..ctor(Type refitInterfaceType, RefitSettings refitSettings) in /_/Refit/RequestBuilderImplementation.cs:line 52
at Refit.RequestBuilderImplementation`1..ctor(RefitSettings refitSettings) in /_/Refit/RequestBuilderImplementation.cs:line 19
at Refit.RequestBuilderFactory.Create[T](RefitSettings settings) in /_/Refit/RequestBuilderFactory.cs:line 15
at Refit.RequestBuilder.ForType[T](RefitSettings settings) in /_/Refit/RequestBuilder.cs:line 21
at Refit.RestService.For[T](HttpClient client, RefitSettings settings) in /_/Refit/RestService.cs:line 18
at Refit.RestService.For[T](String hostUrl, RefitSettings settings) in /_/Refit/RestService.cs:line 27
Environment
Version: Refit 5.2.4
Additional context
A workaround is to add another parameter with a different name having the same value.
The text was updated successfully, but these errors were encountered:
Describe the bug
Repeating the same parameter name multiple times in the url template causes Refit to crash at runtime
Steps To Reproduce
The repeated
zoneId
parameter in the code below causes the generated Refit code to crash at runtime. The exception is:System.ArgumentException: An item with the same key has already been added
.Expected behavior
The code does not crash.
Screenshots
Environment
Additional context
A workaround is to add another parameter with a different name having the same value.
The text was updated successfully, but these errors were encountered: