dotnet / efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
https://docs.microsoft.com/ef/
MIT License
13.78k stars 3.19k forks source link

How to troubleshoot Cosmos DB connection errors? #30645

Closed danielniccoli closed 1 year ago

danielniccoli commented 1 year ago

Ask a question

I started a basic Blazor Server App project and added Cosmos DB support and a single model Blueprint. When running a simple fetch on my Cosmos DB, I get an error where I need some guidance on how to troubleshoot that.

Microsoft.Azure.Cosmos.CosmosException : Response status code does not indicate success: NotFound (404); Substatus: 0; ActivityId: 34b01955-94e6-4dc5-bb90-dd865b8dcdbf; Reason: (Message: {"Errors":["Resource Not Found. Learn more: https:\/\/aka.ms\/cosmosdb-tsg-not-found"]}

Find the complete stack trace further down.

Include your code

Program.cs

I'm using a local secrets.json and I can confirm that variable builder.Configuration["FactorioStudioContext"] contains the correct configuration string.

using FactorioStudio.Data;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.EntityFrameworkCore;
using Microsoft.Identity.Web;
using Microsoft.Identity.Web.UI;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddDbContext<FactorioStudioContext>(options =>
    options.UseCosmos(builder.Configuration["FactorioStudioContext"], databaseName: "FactorioStudio"));

builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
    .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAd"));
builder.Services.AddControllersWithViews()
    .AddMicrosoftIdentityUI();

// ...

Data\FactorioStudioContext.cs

using Microsoft.EntityFrameworkCore;
using System.Diagnostics;

namespace FactorioStudio.Data;

public class FactorioStudioContext : DbContext
{

    public FactorioStudioContext(DbContextOptions<FactorioStudioContext> options) : base(options)
    {
    }

    public DbSet<Blueprint> Blueprints { get; set; }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Blueprint>()
            .ToContainer("Blueprints")
            .HasPartitionKey(o => o.Id)
            .UseETagConcurrency();

        base.OnModelCreating(modelBuilder);
    }
}

Data\Blueprint.cs

namespace FactorioStudio.Data;

public class Blueprint
{
    public Guid Id { get; set; }
    public string Name { get; set; }
}

Pages\Blueprints\Index.cshtml.cs (Scaffolded via VS2022)

using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using FactorioStudio.Data;

namespace FactorioStudio.Pages.Blueprints;

public class IndexModel : PageModel
{
    private readonly FactorioStudioContext _context;

    public IndexModel(FactorioStudioContext context)
    {
        _context = context;
    }

    public IList<Blueprint> Blueprint { get;set; } = default!;

    public async Task OnGetAsync()
    {
        if (_context.Blueprints != null)
        {
            Blueprint = await _context.Blueprints.ToListAsync();
        }
    }
}

My Cosmos DB database is named "FactorioStudio" (see also Program.cs) and the container is named "FactorioStudioContext" (using the name derived from the DbContext class that is used by default by efcore).

grafik

Include stack traces

Microsoft.Azure.Cosmos.CosmosException : Response status code does not indicate success: NotFound (404); Substatus: 0; ActivityId: 34b01955-94e6-4dc5-bb90-dd865b8dcdbf; Reason: (Message: {"Errors":["Resource Not Found. Learn more: https:\/\/aka.ms\/cosmosdb-tsg-not-found"]}
ActivityId: 34b01955-94e6-4dc5-bb90-dd865b8dcdbf, Request URI: /apps/f4a8289a-6ec1-4489-bd84-6cb661ea7acc/services/44a9db3c-cb81-4fcc-8900-6050f993e258/partitions/b9d8f5a5-2340-4616-9d77-d440bd17b039/replicas/133252797114683732s, RequestStats: 
RequestStartTime: 2023-04-06T20:33:09.3761175Z, RequestEndTime: 2023-04-06T20:33:09.3761175Z,  Number of regions attempted:1
{"systemHistory":[{"dateUtc":"2023-04-06T20:31:49.7247347Z","cpu":1.555,"memory":653757752.000,"threadInfo":{"isThreadStarving":"False","threadWaitIntervalInMs":0.0153,"availableThreads":32762,"minThreads":64,"maxThreads":32767},"numberOfOpenTcpConnection":1901},{"dateUtc":"2023-04-06T20:32:09.7250848Z","cpu":1.949,"memory":654477196.000,"threadInfo":{"isThreadStarving":"False","threadWaitIntervalInMs":0.012,"availableThreads":32760,"minThreads":64,"maxThreads":32767},"numberOfOpenTcpConnection":1902},{"dateUtc":"2023-04-06T20:32:19.7352583Z","cpu":1.575,"memory":654480580.000,"threadInfo":{"isThreadStarving":"False","threadWaitIntervalInMs":0.0136,"availableThreads":32763,"minThreads":64,"maxThreads":32767},"numberOfOpenTcpConnection":1903},{"dateUtc":"2023-04-06T20:32:29.7454321Z","cpu":1.325,"memory":654490364.000,"threadInfo":{"isThreadStarving":"False","threadWaitIntervalInMs":0.0146,"availableThreads":32763,"minThreads":64,"maxThreads":32767},"numberOfOpenTcpConnection":1903},{"dateUtc":"2023-04-06T20:32:39.7556055Z","cpu":1.387,"memory":654486284.000,"threadInfo":{"isThreadStarving":"False","threadWaitIntervalInMs":0.018,"availableThreads":32763,"minThreads":64,"maxThreads":32767},"numberOfOpenTcpConnection":1899},{"dateUtc":"2023-04-06T20:32:59.7559501Z","cpu":1.703,"memory":654474848.000,"threadInfo":{"isThreadStarving":"False","threadWaitIntervalInMs":0.0198,"availableThreads":32761,"minThreads":64,"maxThreads":32767},"numberOfOpenTcpConnection":1899}]}
RequestStart: 2023-04-06T20:33:09.3761175Z; ResponseTime: 2023-04-06T20:33:09.3761175Z; StoreResult: StorePhysicalAddress: rntbd://10.0.1.14:11000/apps/f4a8289a-6ec1-4489-bd84-6cb661ea7acc/services/44a9db3c-cb81-4fcc-8900-6050f993e258/partitions/b9d8f5a5-2340-4616-9d77-d440bd17b039/replicas/133252797114683732s, LSN: 16, GlobalCommittedLsn: 16, PartitionKeyRangeId: , IsValid: True, StatusCode: 404, SubStatusCode: 0, RequestCharge: 1, ItemLSN: -1, SessionToken: -1#16, UsingLocalLSN: False, TransportException: null, BELatencyMs: 0.209, ActivityId: 34b01955-94e6-4dc5-bb90-dd865b8dcdbf, RetryAfterInMs: , TransportRequestTimeline: {"requestTimeline":[{"event": "Created", "startTimeUtc": "2023-04-06T20:33:09.3761175Z", "durationInMs": 0.0118},{"event": "ChannelAcquisitionStarted", "startTimeUtc": "2023-04-06T20:33:09.3761293Z", "durationInMs": 0.0027},{"event": "Pipelined", "startTimeUtc": "2023-04-06T20:33:09.3761320Z", "durationInMs": 0.0998},{"event": "Transit Time", "startTimeUtc": "2023-04-06T20:33:09.3762318Z", "durationInMs": 0.481},{"event": "Received", "startTimeUtc": "2023-04-06T20:33:09.3767128Z", "durationInMs": 0.0514},{"event": "Completed", "startTimeUtc": "2023-04-06T20:33:09.3767642Z", "durationInMs": 0}],"serviceEndpointStats":{"inflightRequests":1,"openConnections":1},"connectionStats":{"waitforConnectionInit":"False","callsPendingReceive":0,"lastSendAttempt":"2023-04-06T20:33:09.0761307Z","lastSend":"2023-04-06T20:33:09.0761307Z","lastReceive":"2023-04-06T20:33:09.0761307Z"},"requestSizeInBytes":488,"responseMetadataSizeInBytes":135,"responseBodySizeInBytes":87};
 ResourceType: Collection, OperationType: Read
RequestStart: 2023-04-06T20:33:09.3761175Z; ResponseTime: 2023-04-06T20:33:09.3761175Z; StoreResult: StorePhysicalAddress: rntbd://10.0.1.15:11000/apps/f4a8289a-6ec1-4489-bd84-6cb661ea7acc/services/44a9db3c-cb81-4fcc-8900-6050f993e258/partitions/b9d8f5a5-2340-4616-9d77-d440bd17b039/replicas/133252797114683731s, LSN: 16, GlobalCommittedLsn: 16, PartitionKeyRangeId: , IsValid: True, StatusCode: 404, SubStatusCode: 0, RequestCharge: 1, ItemLSN: -1, SessionToken: -1#16, UsingLocalLSN: False, TransportException: null, BELatencyMs: 0.19, ActivityId: 34b01955-94e6-4dc5-bb90-dd865b8dcdbf, RetryAfterInMs: , TransportRequestTimeline: {"requestTimeline":[{"event": "Created", "startTimeUtc": "2023-04-06T20:33:09.3761175Z", "durationInMs": 0.0043},{"event": "ChannelAcquisitionStarted", "startTimeUtc": "2023-04-06T20:33:09.3761218Z", "durationInMs": 0.0011},{"event": "Pipelined", "startTimeUtc": "2023-04-06T20:33:09.3761229Z", "durationInMs": 0.0591},{"event": "Transit Time", "startTimeUtc": "2023-04-06T20:33:09.3761820Z", "durationInMs": 0.4316},{"event": "Received", "startTimeUtc": "2023-04-06T20:33:09.3766136Z", "durationInMs": 0.072},{"event": "Completed", "startTimeUtc": "2023-04-06T20:33:09.3766856Z", "durationInMs": 0}],"serviceEndpointStats":{"inflightRequests":1,"openConnections":1},"connectionStats":{"waitforConnectionInit":"False","callsPendingReceive":0,"lastSendAttempt":"2023-04-06T20:33:09.3661163Z","lastSend":"2023-04-06T20:33:09.3661163Z","lastReceive":"2023-04-06T20:33:09.3761175Z"},"requestSizeInBytes":488,"responseMetadataSizeInBytes":135,"responseBodySizeInBytes":87};
 ResourceType: Collection, OperationType: Read
, SDK: Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Cosmos.Tracing.TraceData.ClientSideRequestStatisticsTraceDatum, Windows/10.0.22621 cosmos-netstandard-sdk/3.29.4);
   at Microsoft.Azure.Cosmos.GatewayStoreClient.ParseResponseAsync(HttpResponseMessage responseMessage, JsonSerializerSettings serializerSettings, DocumentServiceRequest request)
   at Microsoft.Azure.Cosmos.GatewayStoreClient.InvokeAsync(DocumentServiceRequest request, ResourceType resourceType, Uri physicalAddress, CancellationToken cancellationToken)
   at Microsoft.Azure.Cosmos.GatewayStoreModel.ProcessMessageAsync(DocumentServiceRequest request, CancellationToken cancellationToken)
   at Microsoft.Azure.Cosmos.GatewayStoreModel.ProcessMessageAsync(DocumentServiceRequest request, CancellationToken cancellationToken)
   at Microsoft.Azure.Cosmos.Routing.ClientCollectionCache.ReadCollectionAsync(String collectionLink, IDocumentClientRetryPolicy retryPolicyInstance, ITrace trace, IClientSideRequestStatistics clientSideRequestStatistics, CancellationToken cancellationToken)
   at Microsoft.Azure.Documents.BackoffRetryUtility`1.ExecuteRetryAsync[TParam,TPolicy](Func`1 callbackMethod, Func`3 callbackMethodWithParam, Func`2 callbackMethodWithPolicy, TParam param, IRetryPolicy retryPolicy, IRetryPolicy`1 retryPolicyWithArg, Func`1 inBackoffAlternateCallbackMethod, Func`2 inBackoffAlternateCallbackMethodWithPolicy, TimeSpan minBackoffForInBackoffCallback, CancellationToken cancellationToken, Action`1 preRetryCallback)
   at Microsoft.Azure.Documents.ShouldRetryResult.ThrowIfDoneTrying(ExceptionDispatchInfo capturedException)
   at Microsoft.Azure.Documents.BackoffRetryUtility`1.ExecuteRetryAsync[TParam,TPolicy](Func`1 callbackMethod, Func`3 callbackMethodWithParam, Func`2 callbackMethodWithPolicy, TParam param, IRetryPolicy retryPolicy, IRetryPolicy`1 retryPolicyWithArg, Func`1 inBackoffAlternateCallbackMethod, Func`2 inBackoffAlternateCallbackMethodWithPolicy, TimeSpan minBackoffForInBackoffCallback, CancellationToken cancellationToken, Action`1 preRetryCallback)
   at Microsoft.Azure.Cosmos.Common.CollectionCache.<>c__DisplayClass10_0.<<ResolveByNameAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.Azure.Cosmos.Common.AsyncCache`2.GetAsync(TKey key, TValue obsoleteValue, Func`1 singleValueInitFunc, CancellationToken cancellationToken, Boolean forceRefresh)
   at Microsoft.Azure.Cosmos.Common.CollectionCache.ResolveByNameAsync(String apiVersion, String resourceAddress, Boolean forceRefesh, ITrace trace, IClientSideRequestStatistics clientSideRequestStatistics, CancellationToken cancellationToken)
   at Microsoft.Azure.Cosmos.ClientContextCore.GetCachedContainerPropertiesAsync(String containerUri, ITrace trace, CancellationToken cancellationToken)
--- Cosmos Diagnostics ---{"Summary":{"GatewayCalls":{"(404, 0)":1}},"name":"FeedIterator Read Next Async","id":"5986a795-707e-466a-b7b2-6f84b93f1902","start time":"08:33:12:807","duration in milliseconds":562.2456,"data":{"Client Configuration":{"Client Created Time Utc":"2023-04-06T20:33:12.7803848Z","MachineId":"hashedMachineName:04106266-0c19-b9a6-a48c-46580d70d140","NumberOfClientsCreated":1,"NumberOfActiveClients":1,"ConnectionMode":"Direct","User Agent":"cosmos-netstandard-sdk/3.31.2|1|X64|Microsoft Windows 10.0.22621|.NET 7.0.4|N| Microsoft.EntityFrameworkCore.Cosmos/7.0.4","ConnectionConfig":{"gw":"(cps:50, urto:10, p:False, httpf: False)","rntbd":"(cto: 5, icto: -1, mrpc: 30, mcpe: 65535, erd: True, pr: ReuseUnicastPort)","other":"(ed:False, be:False)"},"ConsistencyConfig":"(consistency: NotSet, prgns:[], apprgn: )","ProcessorCount":20},"Query Correlated ActivityId":"1bdb63d7-ac57-4ccf-b9cf-20e2254810a5"},"children":[{"name":"Create Query Pipeline","id":"d0e05894-8fb7-4ddf-9037-a0ccac5f4164","start time":"08:33:12:816","duration in milliseconds":548.2177,"children":[{"name":"Get Container Properties","id":"6f79f3fc-7f12-4cfd-8f2a-72593d9b7b9d","start time":"08:33:12:818","duration in milliseconds":545.5058,"children":[{"name":"Get Collection Cache","id":"2f69fd22-79e6-4641-8a06-00fc7d47f6d3","start time":"08:33:12:818","duration in milliseconds":290.2895,"children":[{"name":"Waiting for Initialization of client to complete","id":"f971d694-3005-4ab1-a9ec-a8ecc561b779","start time":"08:33:12:819","duration in milliseconds":289.3905}]},{"name":"Read Collection","id":"65fbdd61-f53b-496a-b43f-db5baef07302","start time":"08:33:13:117","duration in milliseconds":223.1227,"data":{"Client Side Request Stats":{"Id":"AggregatedClientSideRequestStatistics","ContactedReplicas":[],"RegionsContacted":[],"FailedReplicas":[],"AddressResolutionStatistics":[],"StoreResponseStatistics":[],"HttpResponseStats":[{"StartTimeUTC":"2023-04-06T20:33:13.1265451Z","DurationInMs":184.4112,"RequestUri":"https://factoriostudio-db-westeurope.documents.azure.com/dbs/FactorioStudio/colls/Blueprints","ResourceType":"Collection","HttpMethod":"GET","ActivityId":"34b01955-94e6-4dc5-bb90-dd865b8dcdbf","StatusCode":"NotFound","ReasonPhrase":"Not Found"}]},"Exception Message":"Message: {\"Errors\":[\"Resource Not Found. Learn more: https:\\/\\/aka.ms\\/cosmosdb-tsg-not-found\"]}\r\nActivityId: 34b01955-94e6-4dc5-bb90-dd865b8dcdbf, Request URI: /apps/f4a8289a-6ec1-4489-bd84-6cb661ea7acc/services/44a9db3c-cb81-4fcc-8900-6050f993e258/partitions/b9d8f5a5-2340-4616-9d77-d440bd17b039/replicas/133252797114683732s, RequestStats: \r\nRequestStartTime: 2023-04-06T20:33:09.3761175Z, RequestEndTime: 2023-04-06T20:33:09.3761175Z,  Number of regions attempted:1\r\n{\"systemHistory\":[{\"dateUtc\":\"2023-04-06T20:31:49.7247347Z\",\"cpu\":1.555,\"memory\":653757752.000,\"threadInfo\":{\"isThreadStarving\":\"False\",\"threadWaitIntervalInMs\":0.0153,\"availableThreads\":32762,\"minThreads\":64,\"maxThreads\":32767},\"numberOfOpenTcpConnection\":1901},{\"dateUtc\":\"2023-04-06T20:32:09.7250848Z\",\"cpu\":1.949,\"memory\":654477196.000,\"threadInfo\":{\"isThreadStarving\":\"False\",\"threadWaitIntervalInMs\":0.012,\"availableThreads\":32760,\"minThreads\":64,\"maxThreads\":32767},\"numberOfOpenTcpConnection\":1902},{\"dateUtc\":\"2023-04-06T20:32:19.7352583Z\",\"cpu\":1.575,\"memory\":654480580.000,\"threadInfo\":{\"isThreadStarving\":\"False\",\"threadWaitIntervalInMs\":0.0136,\"availableThreads\":32763,\"minThreads\":64,\"maxThreads\":32767},\"numberOfOpenTcpConnection\":1903},{\"dateUtc\":\"2023-04-06T20:32:29.7454321Z\",\"cpu\":1.325,\"memory\":654490364.000,\"threadInfo\":{\"isThreadStarving\":\"False\",\"threadWaitIntervalInMs\":0.0146,\"availableThreads\":32763,\"minThreads\":64,\"maxThreads\":32767},\"numberOfOpenTcpConnection\":1903},{\"dateUtc\":\"2023-04-06T20:32:39.7556055Z\",\"cpu\":1.387,\"memory\":654486284.000,\"threadInfo\":{\"isThreadStarving\":\"False\",\"threadWaitIntervalInMs\":0.018,\"availableThreads\":32763,\"minThreads\":64,\"maxThreads\":32767},\"numberOfOpenTcpConnection\":1899},{\"dateUtc\":\"2023-04-06T20:32:59.7559501Z\",\"cpu\":1.703,\"memory\":654474848.000,\"threadInfo\":{\"isThreadStarving\":\"False\",\"threadWaitIntervalInMs\":0.0198,\"availableThreads\":32761,\"minThreads\":64,\"maxThreads\":32767},\"numberOfOpenTcpConnection\":1899}]}\r\nRequestStart: 2023-04-06T20:33:09.3761175Z; ResponseTime: 2023-04-06T20:33:09.3761175Z; StoreResult: StorePhysicalAddress: rntbd://10.0.1.14:11000/apps/f4a8289a-6ec1-4489-bd84-6cb661ea7acc/services/44a9db3c-cb81-4fcc-8900-6050f993e258/partitions/b9d8f5a5-2340-4616-9d77-d440bd17b039/replicas/133252797114683732s, LSN: 16, GlobalCommittedLsn: 16, PartitionKeyRangeId: , IsValid: True, StatusCode: 404, SubStatusCode: 0, RequestCharge: 1, ItemLSN: -1, SessionToken: -1#16, UsingLocalLSN: False, TransportException: null, BELatencyMs: 0.209, ActivityId: 34b01955-94e6-4dc5-bb90-dd865b8dcdbf, RetryAfterInMs: , TransportRequestTimeline: {\"requestTimeline\":[{\"event\": \"Created\", \"startTimeUtc\": \"2023-04-06T20:33:09.3761175Z\", \"durationInMs\": 0.0118},{\"event\": \"ChannelAcquisitionStarted\", \"startTimeUtc\": \"2023-04-06T20:33:09.3761293Z\", \"durationInMs\": 0.0027},{\"event\": \"Pipelined\", \"startTimeUtc\": \"2023-04-06T20:33:09.3761320Z\", \"durationInMs\": 0.0998},{\"event\": \"Transit Time\", \"startTimeUtc\": \"2023-04-06T20:33:09.3762318Z\", \"durationInMs\": 0.481},{\"event\": \"Received\", \"startTimeUtc\": \"2023-04-06T20:33:09.3767128Z\", \"durationInMs\": 0.0514},{\"event\": \"Completed\", \"startTimeUtc\": \"2023-04-06T20:33:09.3767642Z\", \"durationInMs\": 0}],\"serviceEndpointStats\":{\"inflightRequests\":1,\"openConnections\":1},\"connectionStats\":{\"waitforConnectionInit\":\"False\",\"callsPendingReceive\":0,\"lastSendAttempt\":\"2023-04-06T20:33:09.0761307Z\",\"lastSend\":\"2023-04-06T20:33:09.0761307Z\",\"lastReceive\":\"2023-04-06T20:33:09.0761307Z\"},\"requestSizeInBytes\":488,\"responseMetadataSizeInBytes\":135,\"responseBodySizeInBytes\":87};\r\n ResourceType: Collection, OperationType: Read\r\nRequestStart: 2023-04-06T20:33:09.3761175Z; ResponseTime: 2023-04-06T20:33:09.3761175Z; StoreResult: StorePhysicalAddress: rntbd://10.0.1.15:11000/apps/f4a8289a-6ec1-4489-bd84-6cb661ea7acc/services/44a9db3c-cb81-4fcc-8900-6050f993e258/partitions/b9d8f5a5-2340-4616-9d77-d440bd17b039/replicas/133252797114683731s, LSN: 16, GlobalCommittedLsn: 16, PartitionKeyRangeId: , IsValid: True, StatusCode: 404, SubStatusCode: 0, RequestCharge: 1, ItemLSN: -1, SessionToken: -1#16, UsingLocalLSN: False, TransportException: null, BELatencyMs: 0.19, ActivityId: 34b01955-94e6-4dc5-bb90-dd865b8dcdbf, RetryAfterInMs: , TransportRequestTimeline: {\"requestTimeline\":[{\"event\": \"Created\", \"startTimeUtc\": \"2023-04-06T20:33:09.3761175Z\", \"durationInMs\": 0.0043},{\"event\": \"ChannelAcquisitionStarted\", \"startTimeUtc\": \"2023-04-06T20:33:09.3761218Z\", \"durationInMs\": 0.0011},{\"event\": \"Pipelined\", \"startTimeUtc\": \"2023-04-06T20:33:09.3761229Z\", \"durationInMs\": 0.0591},{\"event\": \"Transit Time\", \"startTimeUtc\": \"2023-04-06T20:33:09.3761820Z\", \"durationInMs\": 0.4316},{\"event\": \"Received\", \"startTimeUtc\": \"2023-04-06T20:33:09.3766136Z\", \"durationInMs\": 0.072},{\"event\": \"Completed\", \"startTimeUtc\": \"2023-04-06T20:33:09.3766856Z\", \"durationInMs\": 0}],\"serviceEndpointStats\":{\"inflightRequests\":1,\"openConnections\":1},\"connectionStats\":{\"waitforConnectionInit\":\"False\",\"callsPendingReceive\":0,\"lastSendAttempt\":\"2023-04-06T20:33:09.3661163Z\",\"lastSend\":\"2023-04-06T20:33:09.3661163Z\",\"lastReceive\":\"2023-04-06T20:33:09.3761175Z\"},\"requestSizeInBytes\":488,\"responseMetadataSizeInBytes\":135,\"responseBodySizeInBytes\":87};\r\n ResourceType: Collection, OperationType: Read\r\n, SDK: Microsoft.Azure.Documents.Common/2.14.0, Microsoft.Azure.Cosmos.Tracing.TraceData.ClientSideRequestStatisticsTraceDatum, Windows/10.0.22621 cosmos-netstandard-sdk/3.29.4"}}]}]}]}

Include verbose output

PM> dotnet ef

                     _/\__       
               ---==/    \\      
         ___  ___   |.    \|\    
        | __|| __|  |  )   \\\   
        | _| | _|   \_/ |  //|\\ 
        |___||_|       /   \\\/\\

Entity Framework Core .NET Command-line Tools 7.0.4

Usage: dotnet ef [options] [command]

Options:
  --version        Show version information
  -h|--help        Show help information
  -v|--verbose     Show verbose output.
  --no-color       Don't colorize output.
  --prefix-output  Prefix output with level.

Commands:
  database    Commands to manage the database.
  dbcontext   Commands to manage DbContext types.
  migrations  Commands to manage migrations.

Use "dotnet ef [command] --help" for more information about a command.
PM> dotnet ef dbcontext list --verbose
Using project 'C:\Users\Daniel\Documents\source\FactorioStudio\FactorioStudio.csproj'.
Using startup project 'C:\Users\Daniel\Documents\source\FactorioStudio\FactorioStudio.csproj'.
Writing 'C:\Users\Daniel\Documents\source\FactorioStudio\obj\FactorioStudio.csproj.EntityFrameworkCore.targets'...
dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=C:\Users\Daniel\AppData\Local\Temp\tmp20EB.tmp /verbosity:quiet /nologo C:\Users\Daniel\Documents\source\FactorioStudio\FactorioStudio.csproj
Writing 'C:\Users\Daniel\Documents\source\FactorioStudio\obj\FactorioStudio.csproj.EntityFrameworkCore.targets'...
dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=C:\Users\Daniel\AppData\Local\Temp\tmp2254.tmp /verbosity:quiet /nologo C:\Users\Daniel\Documents\source\FactorioStudio\FactorioStudio.csproj
Build started...
dotnet build C:\Users\Daniel\Documents\source\FactorioStudio\FactorioStudio.csproj /verbosity:quiet /nologo
C:\Users\Daniel\Documents\source\FactorioStudio\Data\Blueprint.cs(6,19): warning CS8618: Non-nullable property 'Name' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [C:\Users\Daniel\Documents\source\FactorioStudio\FactorioStudio.csproj]
C:\Users\Daniel\Documents\source\FactorioStudio\Program.cs(11,23): warning CS8604: Possible null reference argument for parameter 'connectionString' in 'DbContextOptionsBuilder CosmosDbContextOptionsExtensions.UseCosmos(DbContextOptionsBuilder optionsBuilder, string connectionString, string databaseName, Action<CosmosDbContextOptionsBuilder>? cosmosOptionsAction = null)'. [C:\Users\Daniel\Documents\source\FactorioStudio\FactorioStudio.csproj]

Build succeeded.

C:\Users\Daniel\Documents\source\FactorioStudio\Data\Blueprint.cs(6,19): warning CS8618: Non-nullable property 'Name' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [C:\Users\Daniel\Documents\source\FactorioStudio\FactorioStudio.csproj]
C:\Users\Daniel\Documents\source\FactorioStudio\Program.cs(11,23): warning CS8604: Possible null reference argument for parameter 'connectionString' in 'DbContextOptionsBuilder CosmosDbContextOptionsExtensions.UseCosmos(DbContextOptionsBuilder optionsBuilder, string connectionString, string databaseName, Action<CosmosDbContextOptionsBuilder>? cosmosOptionsAction = null)'. [C:\Users\Daniel\Documents\source\FactorioStudio\FactorioStudio.csproj]
    2 Warning(s)
    0 Error(s)

Time Elapsed 00:00:02.97
Build succeeded.
dotnet exec --depsfile C:\Users\Daniel\Documents\source\FactorioStudio\bin\Debug\net7.0\FactorioStudio.deps.json --additionalprobingpath C:\Users\Daniel\.nuget\packages --runtimeconfig C:\Users\Daniel\Documents\source\FactorioStudio\bin\Debug\net7.0\FactorioStudio.runtimeconfig.json C:\Users\Daniel\.dotnet\tools\.store\dotnet-ef\7.0.4\dotnet-ef\7.0.4\tools\net6.0\any\tools\netcoreapp2.0\any\ef.dll dbcontext list --assembly C:\Users\Daniel\Documents\source\FactorioStudio\bin\Debug\net7.0\FactorioStudio.dll --project C:\Users\Daniel\Documents\source\FactorioStudio\FactorioStudio.csproj --startup-assembly C:\Users\Daniel\Documents\source\FactorioStudio\bin\Debug\net7.0\FactorioStudio.dll --startup-project C:\Users\Daniel\Documents\source\FactorioStudio\FactorioStudio.csproj --project-dir C:\Users\Daniel\Documents\source\FactorioStudio\ --root-namespace FactorioStudio --language C# --framework net7.0 --nullable --working-dir C:\Users\Daniel\Documents\source\FactorioStudio --verbose
Using assembly 'FactorioStudio'.
Using startup assembly 'FactorioStudio'.
Using application base 'C:\Users\Daniel\Documents\source\FactorioStudio\bin\Debug\net7.0'.
Using working directory 'C:\Users\Daniel\Documents\source\FactorioStudio'.
Using root namespace 'FactorioStudio'.
Using project directory 'C:\Users\Daniel\Documents\source\FactorioStudio\'.
Remaining arguments: .
Finding DbContext classes...
Finding IDesignTimeDbContextFactory implementations...
Finding application service provider in assembly 'FactorioStudio'...
Finding Microsoft.Extensions.Hosting service provider...
Using environment 'Development'.
Using application service provider from Microsoft.Extensions.Hosting.
Found DbContext 'FactorioStudioContext'.
Finding DbContext classes in the project...
FactorioStudio.Data.FactorioStudioContext
PM> 

Include provider and version information

EF Core version: 7.0.4 Database provider: Microsoft.EntityFrameworkCore.Cosmos Target framework: .NET 7.0 Operating system: Windows 11 IDE: Visual Studio 2022 17.5

danielniccoli commented 1 year ago

I just saw that I was mistaken. I had explicitly targeted a custom container name. After changing this, the issue was solved.