Skip to content
New issue

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

CSHARP-4886: Mark API that will be removed in 3.0 as obsolete: MongoDB.Bson #1243

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

BorisDog
Copy link
Contributor

Additional entities to consider:
Utf8Helper
IBsonChunk
IBsonChunkSource
IByteBuffer
IChildSerializerConfigurable

@BorisDog BorisDog requested a review from a team as a code owner December 28, 2023 18:41
@BorisDog BorisDog requested review from adelinowona, rstam and sanych-sun and removed request for a team and adelinowona December 28, 2023 18:41
@@ -54,4 +54,25 @@
</PackageReference>
</ItemGroup>

<PropertyGroup>
<NoWarn>
1701;1702; <!--https://github.com/dotnet/roslyn/issues/19640-->
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seemed more efficient to define all warnings suppressions in single place for tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a sign that these changes will be painful for our users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But hopefully significantly less painful than just removing API in 3.0 without prior warning.

@@ -47,6 +47,7 @@ public JsonWriterSettings()
/// <summary>
/// Gets or sets the default JsonWriterSettings.
/// </summary>
[Obsolete("This property will be removed in later release.")]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intention is also to remove all the static defaults and settings related to serialization.
We don't have new builders and configuration API defined yet, and for some time they will co-exist, but it's better to start obsoleting them as early as possible.

Copy link
Contributor

@rstam rstam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First: I think we are doing this way too prematurely. Am waiting for @JamesKovacs to get back to revisit this question with him.

Second: I think there is some uncertainty about what exactly is going to be deprecated. We won't really know for sure until we are close to being done with 3.0 and see what ended up changing and what didn't.

@@ -21,6 +21,7 @@ namespace MongoDB.Bson
/// <summary>
/// Represents a BSON symbol value.
/// </summary>
[Obsolete("This class will be removed in later release.")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this being deprecated? What if a document in the database contains this type of BSON value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like Symbol was deprecated in 1.7.
I am not sure that we should remove this, but we do need to inform users that those classes are not expected to be used. I've changed the comment and added it for the related classes missed before.

/// <summary>
/// A BSON undefined value.
/// </summary>
[Obsolete("Undefined type is depricated and will be removed in later release.")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this being deprecated? What if a document in the database contains this type of BSON value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's depreciated, so users should be informed not to use it accidently.

/// <summary>
/// A BSON symbol.
/// </summary>
[Obsolete("Symbol type is depricated and will be removed in later release.")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this being deprecated? What if a document in the database contains this type of BSON value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's depreciated, so users should be informed not to use it accidently.


<PropertyGroup>
<NoWarn>
CS0618 <!--Temporary disable obsolete warnings due the massive volume of warnings-->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a sign that these changes will be painful for our users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but less painful than just API removal without prior warning. Which is the intention of these obsoletions PRs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have a goal that users who stay on 2.x don't have to deal with these warnings at all.

/// <summary>
/// Gets an instance of BsonBinaryDataGuidGenerator for Unspecified GuidRepresentation.
/// </summary>
public static BsonBinaryDataGuidGenerator UnspecifiedInstance
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this duplicate the property of the same name on line 84?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, fixing a typo.

@@ -22,6 +22,7 @@ namespace MongoDB.Bson.Serialization.IdGenerators
/// </summary>
/// <typeparam name="T">The type of the Id.</typeparam>
// TODO: is it worth trying to remove the dependency on IEquatable<T>?
[Obsolete("This class will be removed in later release.")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted.

@@ -26,6 +26,7 @@ namespace MongoDB.Bson.Serialization
/// <summary>
/// Provides serializers for primitive types.
/// </summary>
[Obsolete("This class will be removed in later release.")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will our user be needing our built-in serializer providers?

@@ -22,6 +22,7 @@ namespace MongoDB.Bson.Serialization
/// <summary>
/// Represents a serialization provider based on a mapping from value types to serializer types.
/// </summary>
[Obsolete("This class will be removed in later release.")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really?

@@ -54,4 +54,25 @@
</PackageReference>
</ItemGroup>

<PropertyGroup>
<NoWarn>
1701;1702; <!--https://github.com/dotnet/roslyn/issues/19640-->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a sign that these changes will be painful for our users.

<NoWarn>
NU5100;
CS0618 <!--Temporary disable obsolete warnings due the massive volume of warnings-->
</NoWarn>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a sign that these changes will be painful for our users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But hopefully significantly less painful than just removing API in 3.0 without prior warning.

@BorisDog BorisDog changed the title CSHARP4886: Mark API that will be removed in 3.0 as obsolete: MongoDB.Bson CSHARP-4886: Mark API that will be removed in 3.0 as obsolete: MongoDB.Bson Mar 1, 2024
Copy link
Contributor Author

@BorisDog BorisDog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed some of the comments.
Please advise what else needs to be deprecated.


<PropertyGroup>
<NoWarn>
CS0618 <!--Temporary disable obsolete warnings due the massive volume of warnings-->
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but less painful than just API removal without prior warning. Which is the intention of these obsoletions PRs.

@@ -21,6 +21,7 @@ namespace MongoDB.Bson
/// <summary>
/// Represents a BSON symbol value.
/// </summary>
[Obsolete("This class will be removed in later release.")]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like Symbol was deprecated in 1.7.
I am not sure that we should remove this, but we do need to inform users that those classes are not expected to be used. I've changed the comment and added it for the related classes missed before.

/// <summary>
/// A BSON undefined value.
/// </summary>
[Obsolete("Undefined type is depricated and will be removed in later release.")]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's depreciated, so users should be informed not to use it accidently.

/// <summary>
/// A BSON symbol.
/// </summary>
[Obsolete("Symbol type is depricated and will be removed in later release.")]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's depreciated, so users should be informed not to use it accidently.

@@ -23,6 +23,7 @@ namespace MongoDB.Bson.Serialization
/// <summary>
/// Provides serializers based on an attribute.
/// </summary>
[Obsolete("This class will be removed in later release.")]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need it as a pubic class?

@@ -22,6 +22,7 @@ namespace MongoDB.Bson.Serialization.IdGenerators
/// </summary>
/// <typeparam name="T">The type of the Id.</typeparam>
// TODO: is it worth trying to remove the dependency on IEquatable<T>?
[Obsolete("This class will be removed in later release.")]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted.

@@ -26,6 +26,7 @@ namespace MongoDB.Bson.Serialization
/// <summary>
/// Provides serializers for primitive types.
/// </summary>
[Obsolete("This class will be removed in later release.")]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will our user be needing our built-in serializer providers?

@@ -26,7 +26,7 @@ namespace MongoDB.Bson.Serialization.Serializers
public interface IBsonTupleSerializer
{
/// <summary>
/// Gets ths serializer for an item.
/// Gets this serializer for an item.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, done.

<NoWarn>
NU5100;
CS0618 <!--Temporary disable obsolete warnings due the massive volume of warnings-->
</NoWarn>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But hopefully significantly less painful than just removing API in 3.0 without prior warning.

@@ -54,4 +54,25 @@
</PackageReference>
</ItemGroup>

<PropertyGroup>
<NoWarn>
1701;1702; <!--https://github.com/dotnet/roslyn/issues/19640-->
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But hopefully significantly less painful than just removing API in 3.0 without prior warning.

@rstam rstam self-requested a review March 7, 2024 17:10

<PropertyGroup>
<NoWarn>
CS0618 <!--Temporary disable obsolete warnings due the massive volume of warnings-->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have a goal that users who stay on 2.x don't have to deal with these warnings at all.

@@ -28,6 +28,7 @@ namespace MongoDB.Bson.Serialization
/// <summary>
/// Provides serializers for collections.
/// </summary>
[Obsolete("This class will be removed in later release.")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users can write custom serialization providers and in general configure any mix of serialization providers in any order. To do so the providers need to be public.

Removing these classes (or making them internal) removes a feature.

@@ -24,6 +24,7 @@ namespace MongoDB.Bson.Serialization
/// <summary>
/// A helper class used to create and compile delegates for creator maps.
/// </summary>
[Obsolete("This class will be removed in later release.")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought when you said "removed" you meant "removed".

It probably can be made internal.

}
}
}
/* Copyright 2010-present MongoDB Inc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened here?

Why does the entire file appear to be modified?

Same for several other files below.

}
}
}
/* Copyright 2010-present MongoDB Inc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard to tell if you changed anything in this file or not...

Same for several other files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants