I recently started receiving the following error on my protobuf-net grpc calls:
Grpc.Core.RpcException: 'Status(StatusCode=Internal, Detail="Error starting gRPC call: Invalid wire-type (String); this usually means you have over-written a file without truncating or setting the length; see https://stackoverflow.com/q/2152978/23354")'
I already went to that link, but didn't really find anything that really relates to what I am working on.
So, this error started popping up a while ago, when I did write some custom reflection code to do protobuf-net inheritance modeling dynamically via RuntimeTypeModel.
This is my code for this:
    private void InitializeBindingsForGrpcService([NotNull] Type grpcService)
    {
        foreach (var method in grpcService.GetMethods())
        {
            var involvedTypes = method.GetParameters().Select(x => x.ParameterType).ToList();
            involvedTypes.Add(method.ReturnType);
            var cleanTypes = involvedTypes.Where(x => !x.IsGenericType).ToList();
            var taskCleanTypes = involvedTypes.Except(cleanTypes).Select(x => x.CheckAndGetTaskWrappedType());
            cleanTypes.AddRange(taskCleanTypes);
            var genericTypes = cleanTypes.Where(x =>x.IsGenericType);
            foreach (var genericType in genericTypes)
            {
                RegisterBaseChain(genericType);
            }
            var nonGenerics = cleanTypes.Where(x => !x.IsGenericType);
            foreach (var type in nonGenerics)
            {
                if (!type.Namespace.StartsWith("System"))
                {
                    RuntimeTypeModel.Default.Add(type, true);
                }
            }
        }
    }
    private void RegisterBaseChain([NotNull] Type type)
    {
        var baseType = type.BaseType;
        if (baseType == null || baseType == typeof(object))
        {
            return;
        }
        var baseMetaData = RuntimeTypeModel.Default.Add(baseType);
        baseMetaData.AddSubType(m_protoIndex, type);
        m_protoIndex++;
        RegisterBaseChain(baseType);
    }
So, I am now kind of curious where I might be going wrong with this. I'd love to provide more details for this case, but I just don't really know what to put in.
I did check whether all the relevant objects for the given call are properly registered, and that is the case.
Any pointers to what I should do here?
