Questions tagged [.net-core-3.1]

Use this tag for question specifically about .NET Core 3.1, the Long Term Support version of .NET Core 3.0.

enter link description here.NET Core 3.1 is the Long Term Support version of .

848 questions
19
votes
18 answers

Unable to create an object of type 'ApplicationDbContext'. For the different patterns supported at design time

I face the following error when adding the migration of database in .net core This is the error: This is the code in Startup: public void ConfigureServices(IServiceCollection services) { services.AddDbContext(options => …
eman
  • 323
  • 1
  • 2
  • 8
19
votes
6 answers

Derived type's properties missing in JSON response from ASP.NET Core API

The JSON response from my ASP.NET Core 3.1 API controller is missing properties. This happens when a property uses a derived type; any properties defined in the derived type but not in the base/interface will not be serialized to JSON. It seems…
Keith
  • 18,957
  • 10
  • 75
  • 119
14
votes
5 answers

Using Entity Framework Core 3.1 with UseInMemoryDatabase option in ServiceProvider ( Scoped lifetime )

I have migrated a web application project from .NET Core 2.1 to 3.1 (also EF Core from 2.1.1 to 3.1.0). After the migration, some unit tests are not working anymore, throwing duplicate keys db exception. I simulated the problem and realize that EF…
James
  • 421
  • 1
  • 5
  • 20
14
votes
1 answer

Problem with EF OrderBy after migration to .net core 3.1

Consider this code: _dbContext.Messages .GroupBy(m => new { MinId = m.SenderId <= m.RecipientId ? m.SenderId : m.RecipientId, MaxId = m.SenderId > m.RecipientId ? m.SenderId : m.RecipientId }) …
14
votes
3 answers

Deserialize anonymous type with System.Text.Json

I am updating some apps for .NET Core 3.x, and as part of that I'm trying to move from Json.NET to the new System.Text.Json classes. With Json.NET, I could deserialize an anonymous type like so: var token =…
superstator
  • 2,353
  • 22
  • 33
13
votes
2 answers

.NET Core 3.1 application not building on Azure pipeline anymore (.NET 5)

Until recently our .Net Core 3.1 applications were building and publishing fine on Azure pipelines. But over the last couple of days the build pipelines have started to fail with the error: ##[error]C:\Program…
12
votes
1 answer

.NET Core 3.1 loading config from appsettings.json for console application

For .NET Core 3.1, console application how can I read a complex object from appsetting.json file and cast it into the corresponding object? All the examples I see online seem to be for previous versions of .NET core and things seems to have changed…
stuck_inside_task
  • 125
  • 1
  • 1
  • 5
12
votes
4 answers

.NET Core 3.1 - Could not load file or assembly System.Runtime, Version=4.2.2.0

.NET Core 3.1 console app generates error during build - System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file …
Maxwell
  • 131
  • 1
  • 1
  • 8
11
votes
3 answers

Can I update to .Net 5 NuGet packages even if I'm using .Net Core 3.1?

I was looking for some NuGet updates about my project libraries. I see that there are a lot of Microsoft libraries update to v5.0.0. Based on my knowledge I think these are new dependencies released with .Net 5.0 and I'm not sure that I can update…
E.Benedos
  • 805
  • 5
  • 25
11
votes
2 answers

Specified framework 'Microsoft.AspNetCore.App', version '3.1.0' was not found for a Linux Azure WebApp

Problem After upgrading a .Net Core 2.2 Linux Web App to .Net Core 3.1 in Azure, the application is down with a Specified framework 'Microsoft.AspNetCore.App', version '3.1.0' was not found error. I even went as far to create a new Linux Web App…
w00ngy
  • 1,228
  • 15
  • 22
11
votes
1 answer

Execute stored procedure in EF Core 3.0 vs 2.2

I am trying to update my code to accommodate changes in EF Core 3.0, specifically the deprecation of ExecuteSqlCommand. The following code was working in 2.2 but as stated, I need to get rid of ExecuteSqlCommand: SqlParameter srcid = new…
10
votes
1 answer

CS1061 'IConfigurationSection' does not contain a definition for 'Bind'

I have .netcore 3.1 application and I want to update it to .net 5.0 I have the following code public static IAppSettings ConfigureAppSettings(this IServiceCollection services, IConfiguration configuration) { void ConfigureSection
Hakan Fıstık
  • 11,376
  • 8
  • 74
  • 105
10
votes
1 answer

.NET Core 3.1 Worker Service - set EnvironmentName on publish

I'm trying to setup a worker service using the asp.net core 3.1 template provided by VS 2019 Enterprise. So far: 1 / Created a new project and ran it: "Hosting Environment: Development", works as expected. Development 2 / Created a FileSystem…
Karuskrokro
  • 103
  • 1
  • 7
10
votes
2 answers

Attribute JsonProperty works incorrect with .NET Core 3.1 when I use underscore symbol

I have the following JSON for patch request: { "idfa": "28A427FE-770B-4FA3-AA8E-123", "idfv": "11B3343C-ECBB-4CC8123B5BA-DDD9CA5768FD", "app_build_number": 1, "app_version": "1.0.0", "screen_height": 820, "screen_width":…
Aleksej_Shherbak
  • 1,608
  • 2
  • 20
  • 39
10
votes
1 answer

HttpContext is NULL when running web app in IIS

I have two application, both running on the same Windows machine. One application is IdentityServer4, and the other is my own web application (Server side Blazor app). Both web apps are build with .NET Core 3.1. When I navigate to my web app, I…
Vivendi
  • 16,485
  • 22
  • 93
  • 175
1
2 3
56 57