Closed mind-bending-forks closed 3 years ago
If you cannot use the default data type, you should use one of the Common Language System (CLS)-compliant integral types, Byte, Int16, Int32, or Int64 to make sure that all values of the enumeration can be represented in CLS-compliant programming languages.
So, please consider making one of the following changes:
- If the fact that it is a
ushort
specifically is relied upon and required, then change its underlying type toSystem.UInt16
, otherwise- alter the code such that its underlying type is the default
System.Int32
.
According to the wiki, the compression method field in the header is 2 byte. If the author takes into account compatibility, this warning could be suppressed without any risk.
Besides, ushort
is just a syntactic sugar and it equals to UInt16
, which is not a CLS-compliant integral type either.
A stated above, this field is not 32 bits but 16 bits. ushort or UInt is the right type to use for that field, according to the standard. You may disable that FXCop warning with a directive.
The FxCop static analysers are reporting CA1028 against the following line in ZipStorer.cs:
These state that
So, please consider making one of the following changes:
ushort
specifically is relied upon and required, then change its underlying type toSystem.UInt16
, otherwiseSystem.Int32
.Thanks.