How to target NHibernate.IQueryOver<T>.List using Resharper's external annotations?

StackOverflow https://stackoverflow.com/questions/22413450

  •  14-06-2023
  •  | 
  •  

Domanda

I'm in love with Resharper's external annotation (NotNull, CanBeNull, ...) and would like to add some to certain NHibernate methods. I'm currently trying to annotate the two methods NHiberate.IQueryOver<T>.List() and NHibernate.IQueryOver<T>.List<U>() with NotNull, but unable to get Resharper to use my annotations.

I'm currently trying to generate annotations for NHibernate using the built-in (internal) tool Annotator, at pass 62, and no way to know how many passes are required, or if it will provide me with any clues.

Attempts so far, stored in C:\Program Files (x86)\JetBrains\ReSharper\v7.1\Bin\ExternalAnnotations\NHibernate\NHibernate.NotNull.xml. I'm basically guessing.

<assembly name="NHibernate">
    <member name="M:NHibernate.IQueryOver`1.List">
        <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </member>

    <member name="M:NHibernate.IQueryOver`1.List()">
        <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </member>

    <member name="M:NHibernate.IQueryOver``1.List">
        <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </member>

    <member name="M:NHibernate.IQueryOver``1.List()">
        <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </member>

    <member name="M:NHibernate.IQueryOver`1.List`1">
        <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </member>

    <member name="M:NHibernate.IQueryOver`1.List`1()">
        <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </member>

    <member name="M:NHibernate.IQueryOver``1.List`1">
        <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </member>

    <member name="M:NHibernate.IQueryOver``1.List`1()">
        <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </member>

    <member name="M:NHibernate.IQueryOver`1.List``1">
        <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </member>

    <member name="M:NHibernate.IQueryOver`1.List``1()">
        <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </member>

    <member name="M:NHibernate.IQueryOver``1.List``1">
        <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </member>

    <member name="M:NHibernate.IQueryOver``1.List``1()">
        <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </member>
</assembly>
È stato utile?

Soluzione

I'm unable to say exactly where the problem is, but I basically created mockup interfaces with identical declarations, generated xmldoc and copied the generated method definitions into the annotation xml. I also redid the complete annotation file starting with a blank xml file.

<assembly name="NHibernate">
    <member name="M:NHibernate.IQueryOver`1.List">
        <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </member>

    <member name="M:NHibernate.IQueryOver`1.List``1">
        <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </member>
</assembly>

My above try-everything-approach should have matched, but didn't. I guess there were some issues with whitespaces or just bad luck.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top