We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version 5.0.17/Fedora Linux/.NET 6.0
Describe the bug Arrays don't work when using custom constructors
Code to Reproduce
public class MultiCtorWithArray { public int Id { get; set; } public string[] StrArr { get; set; } public string Name { get; set; } public string DefinedOnlyInStrArray { get; set; } public MultiCtorWithArray() { } [BsonCtor] public MultiCtorWithArray(int id, string[] strarr) { this.Id = id; this.StrArr = strarr; this.DefinedOnlyInStrArray = "changed"; } public MultiCtorWithArray(int id, string[] strarr, string name) { this.Id = id; this.StrArr = strarr; this.Name = name; } } [Fact] public void BsonCtorWithArray_Attribute() { var doc = new BsonDocument { ["_id"] = 25, ["name"] = "value-name", ["strarr"] = new BsonArray() {"foo","bar"} }; var obj = _mapper.ToObject<MultiCtorWithArray>(doc); obj.Id.Should().Be(25); obj.Name.Should().Be("value-name"); string.Join(", ", obj.StrArr).Should().Be("foo, bar"); obj.DefinedOnlyInStrArray.Should().Be("changed"); }
Expected behavior This test (based off the BsonCtor_Attribute test) should pass, but it fails.
The text was updated successfully, but these errors were encountered:
Fixed by pull request #2384
Sorry, something went wrong.
Merge pull request #2384 from athendrix/master
d6f0ca4
Bugfix for #2385 Also adds full record support by fixing this bug.
No branches or pull requests
Version
5.0.17/Fedora Linux/.NET 6.0
Describe the bug
Arrays don't work when using custom constructors
Code to Reproduce
Expected behavior
This test (based off the BsonCtor_Attribute test) should pass, but it fails.
The text was updated successfully, but these errors were encountered: