Skip to content

Bug during DataLoader lookups generation for KeyValuePair<TKey, TEntity> #8434

@tomachristian

Description

@tomachristian

public static KeyValuePair<int, Entity2> CreateLookupKey(Entity1 key)

This seems like it is working when in fact it isn't. Because it expected that the lookup delegate return a nullable KeyValuePair<TKey, TValue>. It does not come up during your tests because you are not compiling or checking the compilation errors, you're just snapshotting.

See the signature here:

public static IPromiseCacheObserver Create<TKey, TValue, TObservedValue>(
        Func<TObservedValue, KeyValuePair<TKey, TValue>?> createLookup,
        DataLoaderBase<TKey, TValue> dataLoader)
        where TKey : notnull

You have to update the source generator to expect KeyValuePair<TKey, TValue>? instead of KeyValuePair<TKey, TValue>.

cc @michaelstaib

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