@@ -147,33 +147,34 @@ private string GenerateDefaultPatchSourceCode(MethodInfo targetMethod)
147147 codeBuilder . Append ( "static void Postfix(" ) ; // System.Reflection.MethodBase __originalMethod
148148
149149 bool isStatic = targetMethod . IsStatic ;
150+
151+ List < string > arguments = new ( ) ;
152+
150153 if ( ! isStatic )
151- codeBuilder . Append ( $ "{ FullDescriptionClean ( targetMethod . DeclaringType ) } __instance") ;
154+ arguments . Add ( $ "{ FullDescriptionClean ( targetMethod . DeclaringType ) } __instance") ;
152155
153156 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") ;
159158
160159 ParameterInfo [ ] parameters = targetMethod . GetParameters ( ) ;
161160
162161 int paramIdx = 0 ;
163162 foreach ( ParameterInfo param in parameters )
164163 {
165- codeBuilder . Append ( $ ", { FullDescriptionClean ( param . ParameterType ) } __{ paramIdx } ") ;
164+ arguments . Add ( $ "{ FullDescriptionClean ( param . ParameterType ) } __{ paramIdx } ") ;
166165 paramIdx ++ ;
167166 }
168167
168+ codeBuilder . Append ( string . Join ( ", " , arguments . ToArray ( ) ) ) ;
169+
169170 codeBuilder . Append ( ")\n " ) ;
170171
171172 // Patch body
172173
173174 codeBuilder . AppendLine ( "{" ) ;
174175 codeBuilder . AppendLine ( " try {" ) ;
175176 codeBuilder . AppendLine ( " StringBuilder sb = new StringBuilder();" ) ;
176- codeBuilder . AppendLine ( $ " sb.AppendLine(\" ---- Patched called ----\" );") ;
177+ codeBuilder . AppendLine ( $ " sb.AppendLine(\" ---------------- ----\" );") ;
177178 codeBuilder . AppendLine ( $ " sb.AppendLine(\" { shortSignature } \" );") ;
178179
179180 if ( ! targetMethod . IsStatic )
0 commit comments