Bug description
When a class annotated with MessagePackObject define a property with a type defined in another project, this type is not checked to be properly annotated with MessagePackObject.
Repro steps
Create a first csproj, with a class without attributes
public class Foo
{
public required int Id { get; init; }
}
Create a second project in the same solution, referencing the first one, with in it
public class Program
{
public static void Main()
{
MessagePackSerializer.Serialize(new Bar());
}
}
[MessagePackObject]
public class Bar
{
public Bar()
{
Foo = new Foo { Id = 1 };
}
[Key(0)]
public Foo Foo { get; set; }
}
Expected behavior
A compilation error with MsgPack003 should be raised
Actual behavior
Code compiles, and an exception MessagePack.FormatterNotRegisteredException: SharedData.Foo is not registered in resolver: MessagePack.Resolvers.StandardResolver is thrown at runtime
- Version used: 3.1.4 and master
- Runtime: tested on .NET Core 9 & net472
Bug description
When a class annotated with MessagePackObject define a property with a type defined in another project, this type is not checked to be properly annotated with MessagePackObject.
Repro steps
Create a first csproj, with a class without attributes
Create a second project in the same solution, referencing the first one, with in it
Expected behavior
A compilation error with MsgPack003 should be raised
Actual behavior
Code compiles, and an exception
MessagePack.FormatterNotRegisteredException: SharedData.Foo is not registered in resolver: MessagePack.Resolvers.StandardResolveris thrown at runtime