diff --git a/ICSharpCode.Decompiler/CSharp/Transforms/ReplaceMethodCallsWithOperators.cs b/ICSharpCode.Decompiler/CSharp/Transforms/ReplaceMethodCallsWithOperators.cs index cf9970232..36624535b 100644 --- a/ICSharpCode.Decompiler/CSharp/Transforms/ReplaceMethodCallsWithOperators.cs +++ b/ICSharpCode.Decompiler/CSharp/Transforms/ReplaceMethodCallsWithOperators.cs @@ -274,7 +274,8 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms } foreach (var arg in arguments) { - if (arg.GetResolveResult() is InvocationResolveResult rr && IsStringConcat(rr.Member)) + var rr = arg.GetResolveResult(); + if (rr is InvocationResolveResult irr && IsStringConcat(irr.Member)) { // Roslyn + mcs also flatten nested string.Concat() invocations within a operator+ use, // which causes it to use the incorrect evaluation order despite the code using an @@ -282,6 +283,11 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms // This problem is avoided if the outer call remains string.Concat() as well. return false; } + if (rr.Type.IsByRefLike) + { + // ref structs cannot be converted to object for use with + + return false; + } } // One of the first two arguments must be string, otherwise the + operator