profile
viewpoint
Andrew Arnott AArnott Microsoft Longmont, CO http://blog.nerdbank.net I work for Microsoft on the Visual Studio Platform team by day, and an FOSS developer by night.

AArnott/CodeGeneration.Roslyn 401

Assists in performing Roslyn-based code generation during a build.

AArnott/Bitcoin.NET 7

A .NET Bitcoin library

AArnott/AssemblyRefScanner 4

Scans a given directory tree for interesting assembly references

AArnott/AspNetCore 2

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.

AArnott/AsyncAndThreadingDemo.Wpf 2

A simple WPF that shows up async/threading patterns, including JTF

AArnott/atom2blogger 2

A blog-to-blog conversion utility for transferring a blog published by Atom feed to Blogger.

AArnott/azure-pipelines-yaml 1

Azure Pipelines YAML examples, templates, and community interaction

AArnott/cloudbuild-task 1

Contracts and adapter NPM packages for various cloud build services

AArnott/Clue 1

A Clue board game partner to help you deduce clues. Written in Ruby.

AArnott/ClueBuddy 1

A program to run while playing the popular game Clue to help you deduce all the possible clues possible and win

startedAArnott/CodeGeneration.Roslyn

started time in 5 hours

pull request commentdotnet/pinvoke

Add User32.GetLastInputInfo

That should do it. :)

NotCoffee418

comment created time in a day

pull request commentdotnet/pinvoke

Add User32.GetLastInputInfo

CLA assistant check <br/>Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.<br/><br/>:x: NotCoffee418 sign now<br/><sub>You have signed the CLA already but the status is still pending? Let us recheck it.</sub>

NotCoffee418

comment created time in a day

PR opened dotnet/pinvoke

Add User32.GetLastInputInfo
+68 -1

0 comment

3 changed files

pr created time in a day

issue openeddotnet/Nerdbank.GitVersioning

Sporadic MSBuild hangs with managed git + .NET 5.0

I'm seeing sporadic hangs in MSBuild when using Nerdbank.GitVersioning 3.4.142 with .NET SDK 5.0.100:

Microsoft (R) Build Engine version 16.8.0+126527ff1 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

Attempting to cancel the build...
/Users/vagrant/.nuget/packages/nerdbank.gitversioning/3.4.142-alpha/build/Nerdbank.GitVersioning.Inner.targets(17,5): warning MSB4220: Waiting for the currently executing task "Nerdbank.GitVersioning.Tasks.GetBuildVersion" to cancel.
/Users/vagrant/.nuget/packages/nerdbank.gitversioning/3.4.142-alpha/build/Nerdbank.GitVersioning.Inner.targets(17,5): warning MSB4220: Waiting for the currently executing task "Nerdbank.GitVersioning.Tasks.GetBuildVersion" to cancel.
/Users/vagrant/.nuget/packages/nerdbank.gitversioning/3.4.142-alpha/build/Nerdbank.GitVersioning.Inner.targets(17,5): warning MSB4220: Waiting for the currently executing task "Nerdbank.GitVersioning.Tasks.GetBuildVersion" to cancel.
/Users/vagrant/.nuget/packages/nerdbank.gitversioning/3.4.142-alpha/build/Nerdbank.GitVersioning.Inner.targets(17,5): warning MSB4220: Waiting for the currently executing task "Nerdbank.GitVersioning.Tasks.GetBuildVersion" to cancel.

I've observed the hang on macOS and Windows, I have not (yet) observed it on Linux.

The issue appears to be specific to .NET 5.0; I have not seen it when using .NET SDK 3.1.404.

I didn't find the time to dig deeper yet, but thought I'd be worth sharing the info nonetheless.

created time in a day

issue closedneuecc/MessagePack-CSharp

MessagePack.MessagePackSerializationException: Unexpected msgpack code 130 (fixmap) encountered.

Case:

  • Client sends an event to the server
  • Server received event
  • Deserialize bytes to class model

ER: Bytes deserialized AR: MessagePackSerializationException raised

Stacktrace:

MessagePack.MessagePackSerializationException: Failed to deserialize JoinEvent value.
 ---> MessagePack.MessagePackSerializationException: Unexpected msgpack code 130 (fixmap) encountered.
   at MessagePack.MessagePackReader.ThrowInvalidCode(Byte code)
   at MessagePack.MessagePackReader.ReadArrayHeader()
   at MessagePack.Formatters.JoinEventFormatter1.Deserialize(MessagePackReader& reader, MessagePackSerializerOptions options)
   at MessagePack.MessagePackSerializer.Deserialize[T](MessagePackReader& reader, MessagePackSerializerOptions options)
   --- End of inner exception stack trace ---
   at MessagePack.MessagePackSerializer.Deserialize[T](MessagePackReader& reader, MessagePackSerializerOptions options)
   at MessagePack.MessagePackSerializer.Deserialize[T](ReadOnlyMemory`1 buffer, MessagePackSerializerOptions options, CancellationToken cancellationToken)
   at Server.Program.Main(String[] args)

Bytes arrays on the client-side and server-side identical: Server - 130 166 82 111 111 109 73 100 123 168 78 105 99 107 110 97 109 101 163 102 111 111 Client - 130 166 82 111 111 109 73 100 123 168 78 105 99 107 110 97 109 101 163 102 111 111

Repro project: https://github.com/rdcm/repro_project_msg_pack

  • Just run console Server
  • Run unity client
  • Press 'S' key in client

Dependencies:

Nuget: MessagePack 2.2.60 Unitypackage: MessagePack.Unity.2.2.60.unitypackage Mpc: mpc --version 2.2.60+d61346e6ba Unity: 2019.3.12f1

I have this issue only with unity client, with simple dotnet console client all works as expected.

closed time in 2 days

rdcm

issue commentneuecc/MessagePack-CSharp

MessagePack.MessagePackSerializationException: Unexpected msgpack code 130 (fixmap) encountered.

Your JoinEvent type defined as msgpack-array(because used [Key(0)], [Key(1)], ...). Therefore, mpc usually generate the code as an msgpack-array. If you give -m, mpc forces to generate as msgpack-map.

error msg is correct. serialized data is msgpack-map(from client, with -m option) but deserialize in server requires msgpack-array but Unexpected msgpack code 130 (fixmap) encountered.

rdcm

comment created time in 2 days

issue openedneuecc/MessagePack-CSharp

FormatterNotRegisteredException: $Class is not registered in resolver: MessagePack.Resolvers.StaticCompositeResolver

Bug description

On Unity Player (Not Unity Editor) I have the following Interface (pastebin link: https://pastebin.com/uuutSGzY), when I serialize this interface I'm met with the following error:

"FormatterNotRegisteredException: Messages.IMessage is not registered in resolver: MessagePack.Resolvers.StaticCompositeResolver at MessagePack.FormatterResolverExtensions.Throw (System.Type t, MessagePack.IFormatterResolver resolver) [0x00000] in <00000000000000000000000000000000>:0"

I'm using the stock suggested Unity configuration:

" StaticCompositeResolver.Instance.Register( UnityResolver.Instance, UnityBlitWithPrimitiveArrayResolver.Instance, StandardResolver.Instance );

        var options = MessagePackSerializerOptions.Standard.WithResolver(StaticCompositeResolver.Instance);
        MessagePackSerializer.DefaultOptions = options;"

Repro steps

Serialize anything using the following command:

"MessagePackSerializer.Serialize(message);"

Expected behavior

Message should be serialized without a problem as it happens in Unity Editor

  • Version used:
  • MessagePack 2.2.60 (Latest)
  • Unity 2021.1a6

created time in 2 days

startedAArnott/Validation

started time in 2 days

startedAArnott/Validation

started time in 2 days

issue commentneuecc/MessagePack-CSharp

MessagePack.MessagePackSerializationException: Unexpected msgpack code 130 (fixmap) encountered.

Anyway, is it correct to throw an exception in this case?

rdcm

comment created time in 2 days

issue commentneuecc/MessagePack-CSharp

MessagePack.MessagePackSerializationException: Unexpected msgpack code 130 (fixmap) encountered.

Thanks a lot! Look like the wrong copypasta. Could you explain -m behavior? In which cases this option may be useful?

rdcm

comment created time in 2 days

pull request commentneuecc/MessagePack-CSharp

Avoid `MissingMethodException` on generic classes with `init` property setters

By the way, what about detecting ThrowIfNotWritable in the try-catch and falling back to DynamicMethod?

TypeInfo formatterTypeInfo = null;
try
{
    formatterTypeInfo = DynamicObjectTypeBuilder.BuildType(DynamicAssembly.Value, typeof(T), false, false);
}
// TODO: use perticular exception
catch (NotSupportedException e) when (e.Message.StartsWith("`init` property accessor"))
{
    Formatter = (IMessagePackFormatter<T>)DynamicObjectTypeBuilder.BuildFormatterToDynamicMethod(typeof(T), false, false, false);
    return;
}

if (formatterTypeInfo == null)
{
    return;
}

Formatter = (IMessagePackFormatter<T>)Activator.CreateInstance(formatterTypeInfo.AsType());

which slows down the generation slightly but better thant throw.

In this case, we fix new EmittableMember(allowPrivate) because above becomes allowPrivate:false and dynamicMethod:true.

AArnott

comment created time in 2 days

pull request commentneuecc/MessagePack-CSharp

Avoid `MissingMethodException` on generic classes with `init` property setters

First design generate simply

return new T(/* constructor parameters */)
{
   // all public writable members
}

It will be set member in ctor(user defined) -> set field from generated code.

  • If you have a parameter in ctor, it is usually a private set, therefore, twice set does not occur
  • There is no guarantee to set the parameters received in ctor (as the above example is)

However, init makes parameter in ctor with public set(in reflection view).

Maybe after this PR changed this behaviour #https://github.com/neuecc/MessagePack-CSharp/pull/1095

return new T(/* constructor parameters */)
{
    // all public writable members except used in constructor
}

This change is okay, I think. But we had to be aware that there was a breaking changes.

AArnott

comment created time in 2 days

issue commentneuecc/MessagePack-CSharp

MessagePack.MessagePackSerializationException: Unexpected msgpack code 130 (fixmap) encountered.

remove -m command. https://github.com/rdcm/repro_project_msg_pack/blob/main/Shared/generateSharedCode.sh

It means Force use map mode serialization.

rdcm

comment created time in 3 days

issue commentneuecc/MessagePack-CSharp

Help with serializing nested interfaces typelessly

Hi,

By commenting out

[MessagePackFormatter(typeof(TypelessFormatter))]

it works now. Thank you.

CP-JohnsonHsu

comment created time in 3 days

issue commentneuecc/MessagePack-CSharp

Mutable models for how the dynamic resolvers format types

I would love an option to serialize/deserialize using camelCasing and looking at all the closed issue's about it I am not the only one. We are currently converting large models that are passed to front-end from Json to MessagePack format and Javascript likes them models camelCased. The workaround to add [MessagePack.Key("camelCaseName")] attribute on all the public properties is cumbersome.

For us it would be a big relief to be able to this by either setting this in MessagePackSerializerOptions or by attributing only the model i.e. : [MessagePackObject(keyAsPropertyNameCamelCased: true)]

AArnott

comment created time in 3 days

issue openedneuecc/MessagePack-CSharp

MessagePack.MessagePackSerializationException: Unexpected msgpack code 130 (fixmap) encountered.

Case:

  • Client sends an event to the server
  • Server received event
  • Deserialize bytes to class model

ER: Bytes deserialized AR: MessagePackSerializationException raised

Stacktrace:

MessagePack.MessagePackSerializationException: Failed to deserialize JoinEvent value.
 ---> MessagePack.MessagePackSerializationException: Unexpected msgpack code 130 (fixmap) encountered.
   at MessagePack.MessagePackReader.ThrowInvalidCode(Byte code)
   at MessagePack.MessagePackReader.ReadArrayHeader()
   at MessagePack.Formatters.JoinEventFormatter1.Deserialize(MessagePackReader& reader, MessagePackSerializerOptions options)
   at MessagePack.MessagePackSerializer.Deserialize[T](MessagePackReader& reader, MessagePackSerializerOptions options)
   --- End of inner exception stack trace ---
   at MessagePack.MessagePackSerializer.Deserialize[T](MessagePackReader& reader, MessagePackSerializerOptions options)
   at MessagePack.MessagePackSerializer.Deserialize[T](ReadOnlyMemory`1 buffer, MessagePackSerializerOptions options, CancellationToken cancellationToken)
   at Server.Program.Main(String[] args)

Bytes arrays on the client-side and server-side identical: Server - 130 166 82 111 111 109 73 100 123 168 78 105 99 107 110 97 109 101 163 102 111 111 Client - 130 166 82 111 111 109 73 100 123 168 78 105 99 107 110 97 109 101 163 102 111 111

Repro project: https://github.com/rdcm/repro_project_msg_pack

  • Just run console Server
  • Run unity client
  • Press 'S' key in client

Dependencies:

Nuget: MessagePack 2.2.60 Unitypackage: MessagePack.Unity.2.2.60.unitypackage Mpc: mpc --version 2.2.60+d61346e6ba Unity: 2019.3.12f1

I have this issue only with unity client, with simple dotnet console client all works as expected.

created time in 3 days

pull request commentneuecc/MessagePack-CSharp

Avoid `MissingMethodException` on generic classes with `init` property setters

Thank you, I see that the fields used in the ctor are not to be reassigned. If its behavior is correct, good. But I think it's a story that occurred in another PR, but it's a breaking change from the current release version. Was this change intended and OK?

using MessagePack;
using MessagePack.Resolvers;
using System;

[MessagePackObject(true)]
public class My
{
    public int MyProperty { get; set; } // set or init

    public My(int myProperty) /* dummy */
    {
    }
}

class Program
{
    static void Main(string[] args)
    {
        var m1 = new My(999) { MyProperty = 100 };
        var bin = MessagePackSerializer.Serialize(m1);
        var m2 = MessagePackSerializer.Deserialize<My>(bin);

        // 2.2.60 is `100`
        // AArnott:fix1134 is `0`
        Console.WriteLine(m2.MyProperty);
    }
}
AArnott

comment created time in 3 days

issue commentneuecc/MessagePack-CSharp

Help with serializing nested interfaces typelessly

Hi,

Thanks for the answer. I use latest code from this repository to test my code again then run into this error

System.EntryPointNotFoundException: 'Entry point was not found.'

Stack trace:

MessagePack.Resolvers.DynamicObjectResolver!MessagePack.Formatters.MessagePackTypelessExample_I1C1Formatter1.Serialize(ref MessagePack.MessagePackWriter writer, MessagePackTypelessExample.I1C1 value, MessagePack.MessagePackSerializerOptions options)	Unknown
MessagePack.dll!MessagePack.Formatters.TypelessFormatter.Serialize(ref MessagePack.MessagePackWriter writer, object value, MessagePack.MessagePackSerializerOptions options) Line 209	C#
MessagePack.dll!MessagePack.MessagePackSerializer.Serialize<object>(ref MessagePack.MessagePackWriter writer, object value, MessagePack.MessagePackSerializerOptions options) Line 93	C#
MessagePack.dll!MessagePack.MessagePackSerializer.Serialize<object>(object value, MessagePack.MessagePackSerializerOptions options, System.Threading.CancellationToken cancellationToken) Line 126	C#
MessagePack.dll!MessagePack.MessagePackSerializer.Typeless.Serialize(object obj, MessagePack.MessagePackSerializerOptions options, System.Threading.CancellationToken cancellationToken) Line 40	C#
MessagePackTypelessExample.dll!MessagePackTypelessExample.Program.Main(string[] args) Line 23	C#

I'm not sure if this is my error or there's still something not working. Here's my code,

class Program
{
	static void Main(string[] args)
	{
		var resolver = CompositeResolver.Create(
			new IMessagePackFormatter[] { TypelessFormatter.Instance },
			new IFormatterResolver[] { TypelessObjectResolver.Instance, StandardResolverAllowPrivate.Instance });

		var options = MessagePackSerializerOptions.Standard
			.WithCompression(MessagePackCompression.Lz4BlockArray)
			.WithResolver(resolver);

		var i1c1 = new I1C1("123", "Hmm")
		{
			Object = new I2C1(),
		} as IInterface1;
		var i1c1Bytes = MessagePackSerializer.Typeless.Serialize(i1c1);
	}
}

public interface IInterface1 { }

[MessagePackObject]
public class I1C1 : IInterface1
{
	[Key(0)] public string Name { get; private set; }
	[Key(1)] public string Text { get; private set; }

	[MessagePackFormatter(typeof(TypelessFormatter))]
	[Key(2)] public IInterface2 Object { get; set; }

	public I1C1(string name, string text)
	{
		Name = name;
		Text = text;
	}
}

[MessagePackObject] public class I1C2 : IInterface1 { }

public interface IInterface2 { }
[MessagePackObject] public class I2C1 : IInterface2 { }
[MessagePackObject] public class I2C2 : IInterface2 { }

Thanks.

CP-JohnsonHsu

comment created time in 4 days

issue commentneuecc/MessagePack-CSharp

Help with serializing nested interfaces typelessly

This will fix next release. https://github.com/neuecc/MessagePack-CSharp/pull/1100

CP-JohnsonHsu

comment created time in 4 days

startedAArnott/CodeGeneration.Roslyn

started time in 4 days

issue openedmicrosoft/reverse-proxy

Document SF integration

Add documentation covering SF integration implemented by #257.

created time in 4 days

issue openedneuecc/MessagePack-CSharp

Help with serializing nested interfaces typelessly

Hi.

I'm trying to serialize an instance with interfaces inside but failed. This is what I've gone so far,

static void Main(string[] args)
{
	var resolver = CompositeResolver.Create(
		new IMessagePackFormatter[] { TypelessFormatter.Instance },
		new IFormatterResolver[] { StandardResolverAllowPrivate.Instance });

	var options = MessagePackSerializerOptions.Standard
		.WithCompression(MessagePackCompression.Lz4BlockArray)
		.WithResolver(resolver);

	var i1c1 = new I1C1("123", "Hmm")
	{
		Object = new I2C1(),
	} as IInterface1;
	var i1c1Bytes = MessagePackSerializer.Typeless.Serialize(i1c1);
	var i1c1Back = MessagePackSerializer.Typeless.Deserialize(i1c1Bytes, options);
}

public interface IInterface1 { }

[MessagePackObject]
public class I1C1 : IInterface1
{
	[Key(0)] public string Name { get; private set; }
	[Key(1)] public string Text { get; private set; }

	// This is the problem to my question.
	[MessagePackFormatter(typeof(TypelessFormatter))]
	[Key(2)] public IInterface2 Object { get; set; }

	public I1C1(string name, string text)
	{
		Name = name;
		Text = text;
	}
}

[MessagePackObject]
public class I1C2 : IInterface1 { }

public interface IInterface2 { }

[MessagePackObject]
public class I2C1 : IInterface2 { }

[MessagePackObject]
public class I2C2 : IInterface2 { }

The above code throws an exception

MissingMethodException: Constructor on type 'MessagePack.Formatters.TypelessFormatter' not found.

What should I do? Thanks.

created time in 4 days

startedAArnott/CodeGeneration.Roslyn

started time in 4 days

pull request commentdotnet/Nerdbank.GitVersioning

Add a managed Git implementation

Thanks, @AArnott ! It looks like the package didn't make it to nuget.org, but it's available in the CI feed, so that works for me :).

qmfrederik

comment created time in 4 days

pull request commentneuecc/MessagePack-CSharp

Introduce NetStandard 2.1 target and reduce dependencies

@AArnott In the develop branch the net5.0 target is added but the dependencies still targets all framework so I think the problem will remain. The best solution is to only include necessary dependency through conditions so for me this PR still apply to dev branch.

kvpt

comment created time in 5 days

pull request commentneuecc/MessagePack-CSharp

Introduce NetStandard 2.1 target and reduce dependencies

@AArnott Thanks for the information, no problem I will wait for it, not a blocking issue for me, thanks.

The warning is during the build of a XUnit test project with net5.0. The build give this warning :

MSB3277 : Found conflicts between different versions of "Microsoft.Bcl.AsyncInterfaces" that could not be resolved

I searched in the project.assets.json file of the project and the only dependency that reference this library was MessagePack.

kvpt

comment created time in 5 days

PR opened neuecc/MessagePack-CSharp

Introduce NetStandard 2.1 target and reduce dependencies

When building a net5.0 I have some warnings about Microsoft.Bcl.AsyncInterfaces packages that comes from this library. It turns out that this packages (and others) are native in netstandard 2.1 or net5.0. This PR remove the unnecessary packages on most recent target frameworks.

+11 -4

0 comment

1 changed file

pr created time in 5 days

more