[CSHARP-1382] No property name given in the error message in the case of a "half matching" variable name Created: 14/Aug/15  Updated: 04/May/20  Resolved: 04/May/20

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

Type: Task Priority: Major - P3
Reporter: Matthias Jost [X] Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: question
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows



 Description   

MongoDB C# Driver Exception:

Message=Element '' does not match any field or property of class

The problem was a typo with a property called RequiresAuthenticationFlag instead of RequiresAuthentication.

I do not understand why the driver did not include the name of the variable inside the exception.

Why does the driver not include the element name inside the exception?

When I remove some characters of the DB variable's name, it does not throw a meaningful exception.

DB Property Name: Requires
Class Property Name: RequiresAuthentication

Exception does not contain correct field name.

When it is the other way around. It does contain a full name!

(Class contains Requires and DB RequiresAuthentication)

I think that must be a bug in the exception handling?

(I have posted a question on Stackoverflow too and did not get an answer)

Could you help me? Can you reproduce this? I am working on a Windows Server 2012 with the C# Driver and Visual Studio 2015.



 Comments   
Comment by Matthias Jost [X] [ 14/Aug/15 ]

Here is the SO question: http://stackoverflow.com/questions/31961339/mongodb-c-sharp-driver-exception-message-element-does-not-match-any-field-or

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