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

Response type: Fix deadlock on scenarios with SynchronizationContext when using Response.Container #1401

Merged
merged 16 commits into from
Apr 24, 2020

Conversation

j82w
Copy link
Contributor

@j82w j82w commented Apr 20, 2020

Pull Request Template

Description

The DatabaseResponse.Database is returning DatabaseCore instead of the correct DatabaseInlineCore. To fix this issue the type was converted to inheritance instead of composition.

Composition created a circle reference where DatabaseInlineCore needed DatabaseCore for the actual implementation, but DatabaseCore needed the DatabaseInlineCore for the response creation.

Added a new DatabaseInternal contract. The current model of using virtual makes it difficult to see what the SDK is using internally. This avoids the dangerous casting between the different types. It also prevents creating dependencies on the implementation class.

The other types will be done in a follow up PR to keep the PR to a reasonable size.

Current model

public abstract Database
internal DatabaseCore : Database
internal DatabaseInlineCore : Database

New model

public abstract Database
internal abstract DatabaseInternal : Database
internal DatabaseCore : DatabaseInternal 
internal DatabaseInlineCore : DatabaseCore 

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

bchong95
bchong95 previously approved these changes Apr 20, 2020
Copy link
Member

@kirankumarkolli kirankumarkolli left a comment

Choose a reason for hiding this comment

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

Out of sync with master

ealsur
ealsur previously approved these changes Apr 22, 2020
Microsoft.Azure.Cosmos/src/Resource/Container/Container.cs Outdated Show resolved Hide resolved
@kirankumarkolli
Copy link
Member

Title is not clear on ambiguity. Suggestions?

@j82w j82w changed the title Response type: Fix responses to return correct type Response type: Fix deadlock on scenarios with SynchronizationContext when using Response.Container Apr 24, 2020
Copy link
Member

@FabianMeiswinkel FabianMeiswinkel left a comment

Choose a reason for hiding this comment

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

Thanks - looks good an will simplify our life goign forward

@j82w j82w merged commit 7b9a084 into master Apr 24, 2020
@j82w j82w deleted the users/jawilley/refactor/sealed branch April 24, 2020 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants