@@ -147,33 +147,34 @@ private string GenerateDefaultPatchSourceCode(MethodInfo targetMethod)
147
147
codeBuilder . Append ( "static void Postfix(" ) ; // System.Reflection.MethodBase __originalMethod
148
148
149
149
bool isStatic = targetMethod . IsStatic ;
150
+
151
+ List < string > arguments = new ( ) ;
152
+
150
153
if ( ! isStatic )
151
- codeBuilder . Append ( $ "{ FullDescriptionClean ( targetMethod . DeclaringType ) } __instance") ;
154
+ arguments . Add ( $ "{ FullDescriptionClean ( targetMethod . DeclaringType ) } __instance") ;
152
155
153
156
if ( targetMethod . ReturnType != typeof ( void ) )
154
- {
155
- if ( ! isStatic )
156
- codeBuilder . Append ( ", " ) ;
157
- codeBuilder . Append ( $ "{ FullDescriptionClean ( targetMethod . ReturnType ) } __result") ;
158
- }
157
+ arguments . Add ( $ "{ FullDescriptionClean ( targetMethod . ReturnType ) } __result") ;
159
158
160
159
ParameterInfo [ ] parameters = targetMethod . GetParameters ( ) ;
161
160
162
161
int paramIdx = 0 ;
163
162
foreach ( ParameterInfo param in parameters )
164
163
{
165
- codeBuilder . Append ( $ ", { FullDescriptionClean ( param . ParameterType ) } __{ paramIdx } ") ;
164
+ arguments . Add ( $ "{ FullDescriptionClean ( param . ParameterType ) } __{ paramIdx } ") ;
166
165
paramIdx ++ ;
167
166
}
168
167
168
+ codeBuilder . Append ( string . Join ( ", " , arguments . ToArray ( ) ) ) ;
169
+
169
170
codeBuilder . Append ( ")\n " ) ;
170
171
171
172
// Patch body
172
173
173
174
codeBuilder . AppendLine ( "{" ) ;
174
175
codeBuilder . AppendLine ( " try {" ) ;
175
176
codeBuilder . AppendLine ( " StringBuilder sb = new StringBuilder();" ) ;
176
- codeBuilder . AppendLine ( $ " sb.AppendLine(\" ---- Patched called ----\" );") ;
177
+ codeBuilder . AppendLine ( $ " sb.AppendLine(\" ---------------- ----\" );") ;
177
178
codeBuilder . AppendLine ( $ " sb.AppendLine(\" { shortSignature } \" );") ;
178
179
179
180
if ( ! targetMethod . IsStatic )
0 commit comments