The issue is that System.IO.BinaryWriter has an overloaded Write method, and the one that is being invoked in the IL is that for uint8, however the C# code as generated will invoke the Write method for int32.
This is quite a serious issue, as the de-compiled code compiles without any warnings, however the output of the program as written by the BinaryWriter will be incompatible with the original assembly.
(Issue copied from https://github.com/0xd4d/dnSpy/issues/429 - may already be fixed?)
The following bit of IL:
decompiles with dnSpy to the following bit of C#:
The issue is that
System.IO.BinaryWriter
has an overloadedWrite
method, and the one that is being invoked in the IL is that foruint8
, however the C# code as generated will invoke theWrite
method forint32
.This is quite a serious issue, as the de-compiled code compiles without any warnings, however the output of the program as written by the
BinaryWriter
will be incompatible with the original assembly.