From bc26e6b673ffaba292fe779d22bd9074a9ae9f70 Mon Sep 17 00:00:00 2001 From: Phantom Date: Sat, 13 Aug 2022 01:33:58 +0400 Subject: [PATCH 1/2] Use InvariantCulture for operand to string conversion in Instruction.ToString() --- Mono.Cecil.Cil/Instruction.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Mono.Cecil.Cil/Instruction.cs b/Mono.Cecil.Cil/Instruction.cs index 5fb36049b..a28309874 100644 --- a/Mono.Cecil.Cil/Instruction.cs +++ b/Mono.Cecil.Cil/Instruction.cs @@ -9,6 +9,7 @@ // using System; +using System.Globalization; using System.Text; namespace Mono.Cecil.Cil { @@ -122,11 +123,11 @@ public override string ToString () break; case OperandType.InlineString: instruction.Append ('\"'); - instruction.Append (operand); + instruction.Append (Convert.ToString(operand, CultureInfo.InvariantCulture)); instruction.Append ('\"'); break; default: - instruction.Append (operand); + instruction.Append (Convert.ToString(operand, CultureInfo.InvariantCulture)); break; } From c6781da09108a59ad873f9a7af76ee8ed5eebfc6 Mon Sep 17 00:00:00 2001 From: Phantom Date: Wed, 17 Aug 2022 00:55:06 +0400 Subject: [PATCH 2/2] remove useless convert --- Mono.Cecil.Cil/Instruction.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mono.Cecil.Cil/Instruction.cs b/Mono.Cecil.Cil/Instruction.cs index a28309874..b381674bd 100644 --- a/Mono.Cecil.Cil/Instruction.cs +++ b/Mono.Cecil.Cil/Instruction.cs @@ -123,7 +123,7 @@ public override string ToString () break; case OperandType.InlineString: instruction.Append ('\"'); - instruction.Append (Convert.ToString(operand, CultureInfo.InvariantCulture)); + instruction.Append (operand); instruction.Append ('\"'); break; default: