I have this model:
using ProtoBuf;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestCore.Shared.AppModels
{
[ProtoContract]
public class PersonViewModel
{
public PersonViewModel()
{
}
[ProtoMember(1)]
public int? Id { get; set; }
[ProtoMember(2)]
public string? Name{ get; set; }
[ProtoMember(3)]
public string? Email{ get; set; }
}
}
In the razor page, I call Http.GetByteArrayAsync to retrieve the list of PersonViewModel
byte[] byteArray = await Http.GetByteArrayAsync($"api/PersonView/GetAll/{numResults}");
Finally, I try to deserialize it:
using (var stream = new MemoryStream(byteArray))
{
PersonData = Serializer.Deserialize<List<PersonViewModel>>(stream);
}
The issue is I get the following error in the console:
Unhandled exception rendering component: Invalid wire-type (EndGroup); this usually means you have over-written a file without truncating or setting the length; see https://stackoverflow.com/q/2152978/23354
I looked at this thread to no avail: Using Protobuf-net, I suddenly got an exception about an unknown wire-type
I looked at this thread to no avail: Using Protobuf-net, I suddenly got an exception about an unknown wire-type