Use this tag for questions specifically related to version 7.0 of the .NET platform. For questions on .NET Framework generally, use the .net tag.
Questions tagged [.net-7.0]
1169 questions
3
votes
1 answer
Performance issue with for loop on the initial run on .NET 7
I'm working on a performance sensitive application and considering moving from .NET 6 to .NET 7.
During comparing these two versions I've found that .NET 7 is slower executing a for loop on the initial run.
Testing is done with two separate console…

jrw
- 65
- 1
- 8
3
votes
1 answer
Azure functions isolated NET 7 Unable to Add-Migration of Entity Framework Core
I'm trying to connect Azure Functions (Isolated) with EF Core 7.0.1 using NET 7.
Add-Migration throw an error: Unable to create an object of type 'MyDbContext'.
Error descriptions
All necessary packages already installed.
Here is my project:
Folder…

Trần Như Tuấn Anh
- 73
- 2
3
votes
1 answer
System.Text.Json and polymorphic code: not working with WebApi controllers
With .NET 7.0 being released, System.Text.Json is supposed to support polymorphic code. Unfortunately, it seems like it can't be used out of the box when you need to return a derived type's instance from a controller's method. For instance, suppose…

Luis Abreu
- 4,008
- 9
- 34
- 63
3
votes
0 answers
SqlException: A connection was successfully established with the server, but then an error occurred during the login process
I upgraded my WebApi project from NET6 to NET7. I use EF Core 7 in my project.
I knew that there was a breaking change involving SQL Server and certificates. So I changed my connection string in the project's appsettings.json…

Ivan-Mark Debono
- 15,500
- 29
- 132
- 263
3
votes
1 answer
Alternative to the new C# 11 `required` modifier in C# 10 and earlier
.NET 7 and C# 11 introduce a new modifier required. Documentation says:
The required modifier indicates that the field or property it's
applied to must be initialized by all constructors or by using an
object initializer. Any expression that…

bahrep
- 29,961
- 12
- 103
- 150
3
votes
1 answer
Deserialize a class that implements IEnumerable
I develop a small program which allows to serialize/deserialize a class in Json.
This program, I make it .NET 7 and therefore I use System.Text.Json
So I have an ITest interface. This interface is implemented in two classes TestSuite and…

SuperYUKO
- 35
- 3
3
votes
1 answer
Can enum query parameters be case-insensitive?
When we migrated our application from .NET 6 to .NET 7, we found that enums used as query parameters had changed to being case-sensitive. We quickly started getting complaints from downstream systems, and had to fallback to .NET 6.
Is there a way to…

Torben Nielsen
- 663
- 1
- 8
- 21
3
votes
1 answer
How i can create and edit Function App using NET 7 in Visual Studio 2022 version 17.4
I'm already deployed Function App on Azure portal. But i can't create and edit an Azure Functions with NET 7 in Visual studio 2022 v17.4 (supported NET 7).
How i can create and edit Function App using NET 7 in Visual studio? Thanks all!

Trần Như Tuấn Anh
- 73
- 2
3
votes
3 answers
Is .NET 7 native AOT supported macOS?
There is no information about the macOS platform. Has AOT supported it, or is there any plan?

Echo
- 183
- 2
- 11
3
votes
1 answer
Why is it wrong to serialize a struct?
In a recent project of mine, I am using some struct, the reason I did so is because I am reading from a shared memory 'stream'.
It is not really possible to post the whole code, but I can basically summarize what I am doing:
…

layer07
- 53
- 2
- 8
2
votes
1 answer
First page in ASP.NET Core 7 index.cshtml
I have created a page which if it is launched for the first time shows login options, etc in the body or index. If we log in then home page is shown but if we close the browser and restart debugger then index is shown again even though user is…

Maksio
- 23
- 6
2
votes
0 answers
How to find the source of an unobserved task exception
In our WPF application, we do register an event handler for unobserved task exception:
TaskScheduler.UnobservedTaskException += OnUnobservedTaskException;
with the following method:
private static void OnUnobservedTaskException(object sender,…

J4N
- 19,480
- 39
- 187
- 340
2
votes
1 answer
Serialize a const with System.Text.Json.Serialization
In .NET 7, is there a way to serialize a const?
internal sealed class CreateResourceCommand : BaseCommand
{
public const string CommandName = "CreateResourceCommand";
}
I have many Commands derived from a base who are sent to a message queue.…

Vincent
- 510
- 1
- 5
- 23
2
votes
3 answers
This .NET 7 minimal API always returns 200
I'm quite new to the concept of a minimal API, but the documentation seems quite clear. You only have to use Results or TypedResults to return the response code you want.
So I made a very basic try:
app.MapPost("/api/test", async context =>
{
…

Patrice Cote
- 3,572
- 12
- 43
- 72
2
votes
1 answer
CastException when serializing derived class with System.Text.Json
I've got a simple CLI app that gets some different data depending on args and then JSON serializes it using System.Text.Json.
The problem I'm running into is when serializing a derived class (ie. List in this case) with a custom…

L. Berger
- 266
- 2
- 15