From 9605c24d2363ff262769dd711f05e0f49e3d06eb Mon Sep 17 00:00:00 2001 From: Chris Pulman Date: Wed, 26 Jun 2024 23:54:52 +0400 Subject: [PATCH] Fix for Common Parameter Name used in Generated code (#1735) * Fix For #1724 Common parameter name used in generated code * Use more standard name as other generated code --- .../InterfaceStubGenerator.cs | 4 +- Refit.Tests/InheritedInterfacesApi.cs | 5 + Refit.Tests/InterfaceStubGenerator.cs | 192 +++++++++--------- 3 files changed, 103 insertions(+), 98 deletions(-) diff --git a/InterfaceStubGenerator.Shared/InterfaceStubGenerator.cs b/InterfaceStubGenerator.Shared/InterfaceStubGenerator.cs index ba2aab388..c479e7972 100644 --- a/InterfaceStubGenerator.Shared/InterfaceStubGenerator.cs +++ b/InterfaceStubGenerator.Shared/InterfaceStubGenerator.cs @@ -535,9 +535,9 @@ HashSet memberNames {{ {@return}({returnType})______func(this.Client, ______arguments){configureAwait}; }} - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) {{ - throw ex; + throw ______ex; }} " ); diff --git a/Refit.Tests/InheritedInterfacesApi.cs b/Refit.Tests/InheritedInterfacesApi.cs index 937e3bdc6..a0362baea 100644 --- a/Refit.Tests/InheritedInterfacesApi.cs +++ b/Refit.Tests/InheritedInterfacesApi.cs @@ -66,6 +66,11 @@ public interface IImplementTheInterfaceAndUseRefit : IAmInterfaceEWithNoRefit)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -245,9 +245,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return (global::System.IObservable)______func(this.Client, ______arguments); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -262,9 +262,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return (global::System.IObservable)______func(this.Client, ______arguments); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -279,9 +279,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return await ((global::System.Threading.Tasks.Task>)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -296,9 +296,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -311,9 +311,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -326,9 +326,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return (global::System.IObservable)______func(this.Client, ______arguments); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -341,9 +341,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -356,9 +356,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return await ((global::System.Threading.Tasks.Task>)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -373,9 +373,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return await ((global::System.Threading.Tasks.Task>)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -390,9 +390,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return (global::System.IObservable>)______func(this.Client, ______arguments); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -407,9 +407,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -424,9 +424,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return await ((global::System.Threading.Tasks.Task>)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -441,9 +441,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -458,9 +458,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return (global::System.IObservable)______func(this.Client, ______arguments); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -475,9 +475,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return (global::System.IObservable)______func(this.Client, ______arguments); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -492,9 +492,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return await ((global::System.Threading.Tasks.Task>)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -509,9 +509,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -524,9 +524,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -539,9 +539,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return (global::System.IObservable)______func(this.Client, ______arguments); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -554,9 +554,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -569,9 +569,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return await ((global::System.Threading.Tasks.Task>)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -586,9 +586,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return await ((global::System.Threading.Tasks.Task>)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -603,9 +603,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return (global::System.IObservable>)______func(this.Client, ______arguments); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -620,9 +620,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -637,9 +637,9 @@ public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::R { return await ((global::System.Threading.Tasks.Task>)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } } @@ -690,9 +690,9 @@ public RefitTestsIGitHubApiDisposable(global::System.Net.Http.HttpClient client, { await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -705,9 +705,9 @@ public RefitTestsIGitHubApiDisposable(global::System.Net.Http.HttpClient client, { await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -765,9 +765,9 @@ public RefitTestsTestNestedINestedGitHubApi(global::System.Net.Http.HttpClient c { return await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -782,9 +782,9 @@ public RefitTestsTestNestedINestedGitHubApi(global::System.Net.Http.HttpClient c { return (global::System.IObservable)______func(this.Client, ______arguments); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -799,9 +799,9 @@ public RefitTestsTestNestedINestedGitHubApi(global::System.Net.Http.HttpClient c { return (global::System.IObservable)______func(this.Client, ______arguments); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -816,9 +816,9 @@ public RefitTestsTestNestedINestedGitHubApi(global::System.Net.Http.HttpClient c { return await ((global::System.Threading.Tasks.Task>)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -833,9 +833,9 @@ public RefitTestsTestNestedINestedGitHubApi(global::System.Net.Http.HttpClient c { return await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -848,9 +848,9 @@ public RefitTestsTestNestedINestedGitHubApi(global::System.Net.Http.HttpClient c { return await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -863,9 +863,9 @@ public RefitTestsTestNestedINestedGitHubApi(global::System.Net.Http.HttpClient c { return (global::System.IObservable)______func(this.Client, ______arguments); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -878,9 +878,9 @@ public RefitTestsTestNestedINestedGitHubApi(global::System.Net.Http.HttpClient c { await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -895,9 +895,9 @@ public RefitTestsTestNestedINestedGitHubApi(global::System.Net.Http.HttpClient c { return await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -912,9 +912,9 @@ public RefitTestsTestNestedINestedGitHubApi(global::System.Net.Http.HttpClient c { return (global::System.IObservable)______func(this.Client, ______arguments); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -929,9 +929,9 @@ public RefitTestsTestNestedINestedGitHubApi(global::System.Net.Http.HttpClient c { return (global::System.IObservable)______func(this.Client, ______arguments); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -946,9 +946,9 @@ public RefitTestsTestNestedINestedGitHubApi(global::System.Net.Http.HttpClient c { return await ((global::System.Threading.Tasks.Task>)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -963,9 +963,9 @@ public RefitTestsTestNestedINestedGitHubApi(global::System.Net.Http.HttpClient c { return await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -978,9 +978,9 @@ public RefitTestsTestNestedINestedGitHubApi(global::System.Net.Http.HttpClient c { return await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -993,9 +993,9 @@ public RefitTestsTestNestedINestedGitHubApi(global::System.Net.Http.HttpClient c { return (global::System.IObservable)______func(this.Client, ______arguments); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -1008,9 +1008,9 @@ public RefitTestsTestNestedINestedGitHubApi(global::System.Net.Http.HttpClient c { await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } } @@ -1155,9 +1155,9 @@ public IServiceWithoutNamespace(global::System.Net.Http.HttpClient client, globa { await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -1170,9 +1170,9 @@ public IServiceWithoutNamespace(global::System.Net.Http.HttpClient client, globa { await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -1185,9 +1185,9 @@ public IServiceWithoutNamespace(global::System.Net.Http.HttpClient client, globa { await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } @@ -1200,9 +1200,9 @@ public IServiceWithoutNamespace(global::System.Net.Http.HttpClient client, globa { await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false); } - catch (global::System.Exception ex) + catch (global::System.Exception ______ex) { - throw ex; + throw ______ex; } } }