You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.
[System.CodeDom.Compiler.GeneratedCodeAttribute("","")]
public class GeneratedClass
{
}
public class Test
{
private GeneratedClass _cachedItem;
public GeneratedClass Item
{
get
{
if( this._cachedItem == null )
{
this._cachedItem = new GeneratedClass();
}
return this._cachedItem;
}
}
}
Produces the error:
CodeContracts: warning: The Boolean condition this._cachedItem == null always evaluates to a constant value. If it (or its negation) appear in the source code, you may have some dead code or redundant check
When the GeneratedCodeAttribute attribute is removed, the error no longer occurs. The attribute gets added by the xsd tool in our case, so it is generated code and we'd rather not have to remove the attribute,
We use Code Contracts 1.10.20606.1.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Analyzing the following code:
Produces the error:
When the
GeneratedCodeAttribute
attribute is removed, the error no longer occurs. The attribute gets added by the xsd tool in our case, so it is generated code and we'd rather not have to remove the attribute,We use Code Contracts 1.10.20606.1.
The text was updated successfully, but these errors were encountered: