Protobuf-net Gendarme Errors

173 views Asked by At

Recently came across protobuf-net, awesome library.

I ran it through gendarme and it came up with many performance notifications, e.g:

Target: System.Int32 ProtoBuf.ProtoReader::ReadFieldHeader() Assembly: protobuf-net, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

Severity: High Confidence: High Source: debugging symbols unavailable, IL offset 0x0055 Details: Type 'System.Int32' is being boxed.

If anyone has experience with gendarme how important are these sort of notifications and is this something I could possibly contribute back to protobuf-net by attempting to clean up any Severity: High issues?

1

There are 1 answers

0
Marc Gravell On BEST ANSWER

The specific error you cite comes from:

if(fieldNumber < 1) throw new ProtoException(
    "Invalid field in source data: " + fieldNumber);

so, yes technically this is an unnecessary box - HOWEVER, it is an extreme edge case that is not worth caring about (if you get that exception, you have bigger problems than the box). It could be fixed if it is causing you concern, though.

It is also likely that some further errors will be being raised from the reflection implementation - which would be misleading because in most scenarios that isn't actually used (the code has both a reflection model and a meta-programming model).

I will aim to have a look at what gendarme says next week: update - done - note that most of this was basically "busy work" - it didn't really change anything important, other than it made Gendarme happy.