Have funny error in protobuf-net generated code. .proto definition file contains field named "value" for an object. What protogen.exe generated for that value with -p:detectMissing option:
private int? _value;
[global::ProtoBuf.ProtoMember(50, IsRequired = false, Name=@"value", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.Xml.Serialization.XmlElement(@"value", Order = 50)]
public int value
{
get { return _value ?? default(int); }
set { _value = value; }
}
[global::System.Xml.Serialization.XmlIgnore]
[global::System.ComponentModel.Browsable(false)]
public bool valueSpecified
{
get { return _value != null; }
set { if (value == (_value == null)) _value = value ? value : (int?)null; }
}
private bool ShouldSerializevalue() { return valueSpecified; }
private void Resetvalue() { valueSpecified = false; }
Compiler produces an error thinking that value is a keyword but not class property:
Type of conditional expression cannot be determined because there is no implicit conversion between 'bool' and 'int?'
Made workaround manually altering generated code:
public int valueWorkaround
{
get { return _value ?? default(int); }
}
public bool valueSpecified
{
get { return _value != null; }
set { if (value == (_value == null)) _value = value ? valueWorkaround : (int?)null; }
}
However probably it makes sense to fix code generation also?
thisis added correctly while on other computer it is not ... extremely strange ... Can't really tell for ProtoBufGenerator version as dll indicate 1.0.0.0 (Installer we used for both computers wasprotobuf-net-VS10.msi). - CitizenInsanecsharp.xsltfile and prefixedXXXwiththis.XXXwhen generating code forpublic bool XXXSpecifiedto workaround fields calledvalue... he just forgot to warn everyone in the team for this modification. - CitizenInsanecsharp.xslthere: gist.github.com/3748744 ... Only few lines have been modified compared to the one installed withprotobuf-net-VS10.msiand intend only to workaround fields namedvalue- CitizenInsane