Skip to content
This repository was archived by the owner on Jul 15, 2023. It is now read-only.
This repository was archived by the owner on Jul 15, 2023. It is now read-only.

Malfromed Contract. Found Requires after assignment #29

@voroninp

Description

@voroninp

After abbreviators started to work, we get the error

Malfromed Contract. Found Requires after assignment.

for the following method:

[ContractAbbreviator]
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "value")]
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "userMessage")]
public static void NotDefault<T>(T value, string userMessage)
{
    Contract.Requires<ArgumentException>(!EqualityComparer<T>.Default.Equals(value, default(T)), userMessage);
}

If method's body is inlined as a usual CodeContract, or abbreviator is used within the same assembly no errors appear.

Update
This error occurs only for enum types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions