Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Andrew Arnott
    @AArnott
    When writing the length before the payload itself, that's only easy if you know the length before-hand. Assuming you're serializing directly to the writer, you don't know it's length. And after you write it out, it's usually too late to ask the PipeWriter to let you write to an earlier buffer.
    Aleksander Heintz
    @Alxandr
    Yes. My point is that the length you prefix in the example is an array length. Not a written byte length
    Ie, it's dependent on the length of the items
    Andrew Arnott
    @AArnott
    Oh, that's because it works with all things IBufferWriter<T>. So if you're writing SomeStruct, you're presumably reading the same thing.
    I see, so the Length property, which tracks number of elements written, should be more clearly documented as such so that it's not misinterpreted as bytes written? Is that what you're saying?
    Aleksander Heintz
    @Alxandr
        foreach (T item in items)
        {
            Serialize(prefixingWriter, item);
            count++;
        }
    This is your sample
    count is the number of items written
    Which you could figure out without doing any serializing
    Cause it's just the length of your items enumerable
    Hence, it's "less interesting" of an example
    What I need is to get the number of bytes produced by the Serialize calls
    Andrew Arnott
    @AArnott
    Sure, if you're writing out exactly one T at a time, the Length property isn't useful.
    Ah, ok I see what you're saying.
    My md file doesn't show use of Length because it wasn't needed, but in a common case you will need it, and the doc should show that off.
    Aleksander Heintz
    @Alxandr
    That's what I was getting at :P
    Andrew Arnott
    @AArnott
    So Length will get you that, since your T=byte
    Aleksander Heintz
    @Alxandr
    Yep
    Andrew Arnott
    @AArnott
    I'll fix that. Great feedback.
    Aleksander Heintz
    @Alxandr
    Now to figure out how azure functions collators work... :p
    Andrew Arnott
    @AArnott
    @neuecc I have a couple active PRs and more in queue. Would you like to review them before I complete? I'd like to get 2.0 stable and released within a couple weeks.
    if you get to the two active PRs today, the next one (which builds on one of the active PRs) is AArnott/MessagePack-CSharp@80ea990.
    Ikiru Yoshizaki
    @guitarrapc
    @AArnott Hi, Andrew. @neucc ask me take care about azure pipeline issues.
    Can I clarify what need to be done?
    1. add your MSA account to Azure DevOps MessagePack Project.
    2. add privilege to add custom agent. (for custom build agent.)
    3. add privilege to add Release Pipeline. (to create release for NuGet)
    Aleksander Heintz
    @Alxandr
    @AArnott I'm not seeing v2 of messagepack in the nuget feed you posted btw. Only Cake.GitVersioning, nbgv and Nerdbank.GitVersioning are available.
    Andrew Arnott
    @AArnott
    @guitarrapc Yes, those would all be great.
    @Alxandr It sounds like you're only displaying stable packages. Make sure you display unstable/prerelease packages and the new MessagePack v2 ones should come up.
    Aleksander Heintz
    @Alxandr
    @AArnott Ofcause. You're absolutely right :)
    Ikiru Yoshizaki
    @guitarrapc
    @AArnott alright, will you plz let me know MSA account to add?
    Andrew Arnott
    @AArnott
    Ikiru Yoshizaki
    @guitarrapc
    invited and assigned permissions.
    Aleksander Heintz
    @Alxandr
    @AArnott do you see any obvious reason why this would give me an error:
                Span<byte> data = stackalloc byte[12];
    
                if (!BitConverter.TryWriteBytes(data, nanos))
                    throw new InvalidOperationException("Failed to write nanoseconds.");
    
                if (!BitConverter.TryWriteBytes(data.Slice(4), seconds))
                    throw new InvalidOperationException("Failed to write seconds");
    
                writer.WriteExtensionFormatHeader(new ExtensionHeader(typeCode: -1, length: 12));
                writer.WriteRaw(data);
    CS8350 This combination of arguments to 'MessagePackWriter.WriteRaw(ReadOnlySpan<byte>)' is disallowed because it may expose variables referenced by parameter 'rawMessagePackBlock' outside of their declaration scope
    Aleksander Heintz
    @Alxandr
    Ah. Damn. I'd say this is an API error
    You can't accept Spans in that method
    The MessagePackWriter should be a readonly struct
    Andrew Arnott
    @AArnott
    Yes regarding the error: dotnet/roslyn#23433
    We can accept Spans in the method I think, but they can't be stack-allocated, by the description in the issue.
    @Alxandr would you like to file an issue to track what you'd like to do and your suggestion that we make it a readonly struct? It looks like from a quick view of the type that it's not out of the question.
    Aleksander Heintz
    @Alxandr
    @AArnott making it a readonly struct would solve this issue at least. And you're right, it's only with stack-allocated spans. I'm currently using memory pools instead, but asking the memory pool for 12 bytes feels a bit silly :P
    Andrew Arnott
    @AArnott
    Also MemoryPool<T> always allocates ~12 bytes anyway for every rental. Use ArrayPool<T> instead since it doesn't have that overhead.
    Aleksander Heintz
    @Alxandr
    Sure. But I don't like ArrayPools :p
    Cause I have to make sure to free them
    Using statements is so much cleaner
    Andrew Arnott
    @AArnott
    You can write up a struct and an extension method so you can use the using block with array pools and still be alloc free.
    These are all just general suggestions ... your suggestion to make the MessagePackWriter readonly is still a possibility.
    Aleksander Heintz
    @Alxandr
    Oh. Never thought about that struct idea
    I might do that
    Andrew Arnott
    @AArnott
    @neuecc Can you configure "integrations" on this gitter channel so that we see issue/PR and other events from the github in the activity feed in the right panel?
    Andrew Arnott
    @AArnott
    It looks like Azure Pipelines' default for releases is to auto-trigger, so I inadvertently started pushing all builds to nuget.org. I've unlisted the few that got listed unintentionally and turned off the auto-trigger.
    Andrew Arnott
    @AArnott
    @neuecc Can you review my latest changes in the next few days and see if you have any further API feedback? I want to lock down on a stable 2.0 API soon, and that of course needs your feedback.
    Yoshifumi Kawai
    @neuecc
    @AArnott
    Ok, maybe I will post some issues.