[CSHARP-2220] ISupportInitialize ignored on some versions of .NET Created: 19/Mar/18 Updated: 29/Oct/19 Resolved: 29/Oct/19 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | BSON |
| Affects Version/s: | 2.5 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Yaroslav Taben | Assignee: | Robert Stam |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
.NET Core 2.0 |
||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
The source code (BsonClassMapSerializer.cs) appears to have the following statement around .BeginInit and .EngInit calls: The #if statement was added to avoid dependency on unsupported API where it's not available, but in my case, where NETCOREAPP2_0 is defined instead of NET45, casting document to ISupportInitialize then calling InitBeginand InitEnd seems to work perfectly fine. Can we change the #if condition to something that captures more version that support the feature, or is there another reason to keep it? (If so - would be nice to document it) This created a lot of confusion for me since the docs don't specify version requirement for this feature to work, so I couldn't figure out why EndInit wasn't being called. |
| Comments |
| Comment by Robert Stam [ 02/Oct/18 ] |
|
Once we get our build process changed from multiple solutions (one per target framework) to a single solution targeting multiple frameworks we will be in a position to add a new target framework for NetStandard 2.0, at which time we can re-enable any features that are currently disabled in the NetStandard version of the driver because they required functionality not available in earlier versions of NetStandard.
|