Skip to content

Issue with Nullable Guid Parsing #452

Closed
@ThomasKolarik

Description

@ThomasKolarik

Hello,

In version 0.4.2 there was a fix to parsing nullable enums (#315). However, I am running into a similar issue with nullable guids.

Here is a code sample to demonstrate what is going on, on my end.

    [Document(StorageType = StorageType.Json)]
    public class ItemEntry
    {
        [RedisIdField]
        public Guid Id { get; set; }

        public string Data { get; set; }
    }
    
    private readonly IRedisCollection<ItemEntry> items;
    
    public async Task<ItemEntry> FetchItemAsync(Guid? itemId)
    {
        var items = await this.items.Where(a => a.Id == itemId).ToListAsync();
        
        return items.FirstOrDefault();
    }

Which when called will error out with the follow exception,

  System.ArgumentException:
     at System.Enum.ValidateRuntimeType (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
     at System.Enum.TryParse (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
     at System.Enum.TryParse (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
     at Redis.OM.Common.ExpressionTranslator.TranslateBinaryExpression (Redis.OM, Version=0.6.0.0, Culture=neutral, PublicKeyToken=null)
     at Redis.OM.Common.ExpressionTranslator.BuildQueryFromExpression (Redis.OM, Version=0.6.0.0, Culture=neutral, PublicKeyToken=null)
     at Redis.OM.Searching.RedisCollectionEnumerator`1..ctor (Redis.OM, Version=0.6.0.0, Culture=neutral, PublicKeyToken=null)
     at Redis.OM.Searching.RedisCollection`1.GetAsyncEnumerator (Redis.OM, Version=0.6.0.0, Culture=neutral, PublicKeyToken=null)
     at Redis.OM.Searching.RedisCollection`1+<ToListAsync>d__40.MoveNext (Redis.OM, Version=0.6.0.0, Culture=neutral, PublicKeyToken=null))

As you can see in the error log, I am currently using version 0.6.0.

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