[CSHARP-3037] Correct types in ArgumentException message Created: 01/Apr/20  Updated: 28/Oct/23  Resolved: 08/Apr/20

Status: Closed
Project: C# Driver
Component/s: Builders
Affects Version/s: None
Fix Version/s: 2.11.0

Type: Improvement Priority: Minor - P4
Reporter: Vincent Kam (Inactive) Assignee: Vincent Kam (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Minor Change

 Description   

Contributor description:

Fixing expectation message whereby the wrong type is contained within the exception making it confusing to the end-user.

Take for example the following test:

[Fact]
public void Test1()
{
    PipelineDefinition<BsonDocument, MyType>.Create(new IPipelineStageDefinition[]
    {
        new JsonPipelineStageDefinition<BsonDocument, BsonDocument>(
            @"{ project: { } } "),
    });
}
 
public class MyType { }

This throws the following exception

 
System.ArgumentException : The output type to the last stage was expected to be MongoDB.Bson.BsonDocument, but was MongoDB.Bson.BsonDocument. (Parameter 'stages')

instead of

 
System.ArgumentException : The output type to the last stage was expected to be SomeExample.MyType, but was MongoDB.Bson.BsonDocument. (Parameter 'stages')

Contributor PR:
https://github.com/mongodb/mongo-csharp-driver/pull/392



 Comments   
Comment by Githook User [ 09/Apr/20 ]

Author:

{'name': 'vincentkam', 'email': 'vincent.kam@10gen.com', 'username': 'vincentkam'}

Message: CSHARP-3037: Fix typo
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/caa2b604298223bdf521f2cf7fdfcd6cd9ed68a4

Comment by Githook User [ 08/Apr/20 ]

Author:

{'name': 'kevbite', 'email': 'kev_bite@msn.com', 'username': 'kevbite'}

Message: CSHARP-3037: Correct types in ArgumentException message.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/cddc1367a5f6c02dc32e39e04b9797ac6aebc8ad

Generated at Wed Feb 07 21:44:11 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.