Skip to content

Nullable enum cause circular reference #480

@michalciolek

Description

@michalciolek
  • Fody 6.6.0 and 6.6.4
  • Any Fody weavers being used: Equals 4.0.2
  • .NetFramework

Describe the issue

I added nullable to my enum field in class (with [Equls]):

#nullable enable

namespace NullableEnum
{
    [Equals]
    public class Example
    {
        /// <summary>
        /// This adds a circular reference to self (NullableEnum.exe)!
        /// </summary>
        public ExampleEnum? ExampleEnum { get; set; }


        public static bool operator ==(Example? left, Example? right) => Operator.Weave(left, right);
        public static bool operator !=(Example? left, Example? right) => Operator.Weave(left, right);
    }
}

This cause my result binary to have a (circular) reference to itself:
references

Without nullability, in enum, my result binary does not have reference to itself.

Minimal Repro

I have created a minimal project with this issue:
https://github.com/michalciolek/NullableEnum-fody-equals

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions