Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

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

Closed
BorisDog wants to merge 6 commits into mongodb:main from BorisDog:csharp4886

Conversation

@BorisDog
Copy link
Contributor

@BorisDog BorisDog commented Dec 28, 2023

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

<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

@BorisDog BorisDog Mar 6, 2024

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.

/// <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.

/// <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

@BorisDog BorisDog Mar 1, 2024

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

@BorisDog BorisDog Mar 1, 2024

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

@BorisDog BorisDog Mar 1, 2024

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

@BorisDog BorisDog Mar 1, 2024

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

We can't leave this in here.

This is going to hide important warnings even from ourselves!!!

/// <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

@BorisDog BorisDog Mar 6, 2024

Choose a reason for hiding this comment

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

Yes, fixing a typo.

/// </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

@BorisDog BorisDog Mar 6, 2024

Choose a reason for hiding this comment

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

Reverted.

/// <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

@BorisDog BorisDog Mar 6, 2024

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?

/// <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?


<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

@BorisDog BorisDog Mar 6, 2024

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

We can't leave this in here.

This is going to hide important warnings even from ourselves!!!

@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

@BorisDog BorisDog Mar 1, 2024

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.

/// <summary>
/// Represents a BSON symbol value.
/// </summary>
[Obsolete("This class will be removed in later release.")]
Copy link
Contributor Author

@BorisDog BorisDog Mar 1, 2024

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

@BorisDog BorisDog Mar 1, 2024

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

@BorisDog BorisDog Mar 1, 2024

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>
/// Provides serializers based on an attribute.
/// </summary>
[Obsolete("This class will be removed in later release.")]
Copy link
Contributor Author

@BorisDog BorisDog Mar 6, 2024

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?

/// </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

@BorisDog BorisDog Mar 6, 2024

Choose a reason for hiding this comment

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

Reverted.

/// <summary>
/// Provides serializers for primitive types.
/// </summary>
[Obsolete("This class will be removed in later release.")]
Copy link
Contributor Author

@BorisDog BorisDog Mar 6, 2024

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?

{
/// <summary>
/// Gets ths serializer for an item.
/// Gets this serializer for an item.
Copy link
Contributor Author

@BorisDog BorisDog Mar 6, 2024

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

@BorisDog BorisDog Mar 6, 2024

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.


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

@BorisDog BorisDog Mar 6, 2024

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.

/// <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.

/// <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.

/// <summary>
/// Represents a factory for IBsonBuffers.
/// </summary>
/// ByteBufferFactory
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was line 25 added?

/// <summary>
/// Provides serializers based on an attribute.
/// </summary>
[Obsolete("This class will be removed from public API 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 are we removing serialization providers, including this one?

The user is supposed to be able to configure the serialization providers they want to use.

Copy link
Contributor

Choose a reason for hiding this comment

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

Same for similar obsoletions below...

<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.

We can't leave this in here.

This is going to hide important warnings even from ourselves!!!


<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.

We can't leave this in here.

This is going to hide important warnings even from ourselves!!!

Copy link
Contributor Author

Stale PR.

@BorisDog BorisDog deleted the csharp4886 branch October 17, 2024 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@rstam rstam rstam requested changes

@sanych-sun sanych-sun Awaiting requested review from sanych-sun

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /