Skip to content

Commit

Permalink
Add breaking change for removal of Cosmos sync support
Browse files Browse the repository at this point in the history
  • Loading branch information
ajcvickers committed Mar 25, 2024
1 parent cfd83a1 commit 7ce2276
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 7 deletions.
4 changes: 2 additions & 2 deletions entity-framework/core/learn-more/community-standups.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ Featuring:

Links:

- Product: [Hot Chocolate for GraphQL](https://chillicream.com/docs/hotchocolate/v14)
- Docs: [Hot Chocolate and Entity Framework Core](https://chillicream.com/docs/hotchocolate/v14/integrations/entity-framework)
- Product: [Hot Chocolate for GraphQL](https://chillicream.com/docs/hotchocolate)
- Docs: [Hot Chocolate and Entity Framework Core](https://chillicream.com/docs/hotchocolate/integrations/entity-framework)

<a name="value-generation"></a>

Expand Down
41 changes: 36 additions & 5 deletions entity-framework/core/what-is-new/ef-core-9.0/breaking-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Breaking changes in EF Core 9 (EF9) - EF Core
description: List of breaking changes introduced in Entity Framework Core 9 (EF9)
author: ajcvickers
ms.date: 11/29/2023
ms.date: 03/25/2024
uid: core/what-is-new/ef-core-9.0/breaking-changes
---

Expand All @@ -20,8 +20,39 @@ EF Core 9 targets .NET 8. This means that existing applications that target .NET

## Summary

| **Breaking change** | **Impact** |
|:--------------------|------------|
| | |
| **Breaking change** | **Impact** |
|:-----------------------------------------------------------------------------------|------------|
| [Sync I/O via the Azure Cosmos DB provider is no longer supported](#cosmos-nosync) | Medium |

## High-impact changes
## Medium-impact changes

<a name="cosmos-nosync"></a>

### Sync I/O via the Azure Cosmos DB provider is no longer supported

[Tracking Issue #32563](https://github.com/dotnet/efcore/issues/32563)

#### Old behavior

Previously, calling synchronous methods like `ToList` or `SaveChanges` would cause EF Core to block synchronously using `.GetAwaiter().GetResult()` when executing async calls against the Azure Cosmos DB SDK. This can result in deadlock.

#### New behavior

Starting with EF Core 9.0, EF now throws by default when attempting to use synchronous I/O. The exception message is, "Azure Cosmos DB does not support synchronous I/O. Make sure to use and correctly await only async methods when using Entity Framework Core to access Azure Cosmos DB. See [https://aka.ms/ef-cosmos-nosync](https://aka.ms/ef-cosmos-nosync) for more information."

#### Why

Synchronous blocking on asynchronous methods can result in deadlock, and the Azure Cosmos DB SDK only supports async methods.

#### Mitigations

In EF Core 9.0, the error can be suppressed with:

```csharp
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.ConfigureWarnings(w => w.Ignore(CosmosEventId.SyncNotSupported));
}
```

That being said, applications should stop using sync APIs with Azure Cosmos DB since this is not supported by the Azure Cosmos DB SDK. The ability to suppress the exception will be removed in a future release of EF Core, after which the only option will be to use async APIs.

0 comments on commit 7ce2276

Please sign in to comment.