nickdodd79 / AutoBogus

A C# library complementing the Bogus generator by adding auto creation and population capabilities.
MIT License
431 stars 50 forks source link

Google.Protobuf.WellknownTypes.Value regression in ^2.7.4 #28

Closed petermcneely closed 4 years ago

petermcneely commented 4 years ago

In both versions 2.7.4 and 2.8.0, there is a regression on generating Google.Protobuf.WellknownTypes.Value instances; this used to work as late as version 2.7.3. Using Google.Protobuf 3.11.4, I am able to reproduce the issue with the below console app. Generating throws an AmbiguousMatchException.

using Google.Protobuf.WellKnownTypes;
using System;

namespace AutoBogus.ValueIssue
{
    class Program
    {
        static void Main(string[] args)
        {
            var genClass = AutoFaker.Generate<ProtobufClass>();
            Console.WriteLine($"{nameof(ProtobufClass.Value)}: {genClass.Value}");
        }
    }

    public class ProtobufClass
    {
        public Value Value { get; set; }
    }
}
nickdodd79 commented 4 years ago

Hey @petermcneely

Must be as a result of some dictionary generator changes. I will take a look and get a fix in place.

Nick.

petermcneely commented 4 years ago

Hi @nickdodd79 ,

Thanks for the response. I've narrowed it down to being an issue generating the generic MapField<T, K> type.

petermcneely commented 4 years ago

I modified a few things to get this to work: https://github.com/nickdodd79/AutoBogus/pull/29

nickdodd79 commented 4 years ago

Awesome @petermcneely. Thanks for your contribution. I will verify the changes against my QA process and merge it all good :+1:

nickdodd79 commented 4 years ago

@petermcneely apologies for the delay. I thought I had published a new version with your changes, but today realized that I hadn't. I have just published v2.8.1.

nycdotnet commented 4 years ago

Thank you @nickdodd79 we will try it out presently!

nycdotnet commented 4 years ago

Wanted to say thanks - this is working for us now. Sorry for the long delay. We really appreciate this library and your efforts a lot.