[CSHARP-1992] BsonUtils.TryParseHexString should not swallow all exceptions Created: 02/Jun/17  Updated: 28/Oct/23  Resolved: 15/Jun/17

Status: Closed
Project: C# Driver
Component/s: BSON
Affects Version/s: 2.4.3
Fix Version/s: 2.5

Type: Bug Priority: Major - P3
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

TryParseHexString calls ParseHexString and catches all exceptions and returns false if any exception is thrown by ParseHexString.

But that swallows exceptions unrelated to parsing like OutOfMemoryException.

It should only catch FormatExceptions.

Alternatively, ParseHexString and TryParseHexString could be reimplemented so that no exceptions are ever thrown in the TryParseHexString code path.



 Comments   
Comment by Githook User [ 15/Jun/17 ]

Author:

{u'username': u'rstam', u'name': u'rstam', u'email': u'robert@robertstam.org'}

Message: CSHARP-1992: BsonUtils.TryParseHexString should not swallow all exceptions.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/39cb615f3b519e2a7342976c3f62269a336db610

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