Questions tagged [.net-7.0]

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.

1169 questions
4
votes
1 answer

C# Razor Adding Weird Suffix to Html Tags

I'm using .NET 7, Visual Studio 2022 and Razor Pages, fresh razor page template project. Something is injecting a suffix b-1cs0j1knof after many of my html tags. This happens even in release/published build. How do I disable this? Nothing comes up…
jjxtra
  • 20,415
  • 16
  • 100
  • 140
4
votes
3 answers

How can I pass a parameter to my validator without breaking DI registration? (FluentValidation)

I need to pass a parameter from a parent validator to a child validator, by using .SetValidator() but having trouble with registering a validator to the DI container using FluentValidation's automatic registration, when the validator is…
trymv
  • 175
  • 1
  • 14
4
votes
4 answers

How to have a generic variable to INumber in .NET 7?

We can use the new INumber interface in .NET 7 to reference any numeric type, like the following: using System.Numerics; INumber myNumber = 72; INumber mySecondNumber = 93.63f; However, because of the type constraint in INumber,…
Jossean Yamil
  • 850
  • 2
  • 9
  • 22
4
votes
1 answer

MySQL with Entity Framework on .NET 7

I have the following packages installed: "Microsoft.EntityFrameworkCore" 7.0.0 "Microsoft.EntityFrameworkCore.Design" 7.0.0 "MySql.EntityFrameworkCore" 7.0.0-preview5+MySQL8.0.31 I have my context file class: namespace API.Context { public…
Neigaard
  • 3,726
  • 9
  • 49
  • 85
4
votes
3 answers

Unable to build on Azure Devops after updating to .NET7

I just updated my solution to .NET7. I have a build/release pipeline setup on Azure Devops which now fails in the "Restore" step. This is first error, which is then followed by multiple other errors of the same type: 2:3>Target…
HaukurHaf
  • 13,522
  • 5
  • 44
  • 59
4
votes
0 answers

Entity Framework JSON Column Store data As UniCode in SQL Server

In a .NET 7 Web API project, I try to use EF7 JSON column to store translations of the entity. These are my entities: public class Card { public int Id { get; set; } public string Name { get; set; } public List
4
votes
1 answer

CS0618 'SignOutSessionStateManager' is obsolete: 'Use 'NavigateToLogout' instead. when upgrading Blazor WebAssembly from .NET 6 to .NET 7

Upgrading Blazor WebAssembly with individual user accounts I got the error below: Error (active) CS0618 'SignOutSessionStateManager' is obsolete:…
Ogglas
  • 62,132
  • 37
  • 328
  • 418
4
votes
0 answers

Visual Studio 2022 .net 6 or 7 winform designer cannot generate event handler code automatically after renaming MainForm

I have a question while using Visual studio 2002 for winform .net 6 or 7 Visual Studio 2022 .net 6 or 7 winform designer cannot generate event handler code automatically after renaming "Form" to "MainForm". I tried to double click winform designer…
kdm
  • 101
  • 3
4
votes
3 answers

Installing .NET 7 preview breaks MAUI build

Since installing the .net 7 preview I can no longer build .net maui projects. I've uninstalled the preview and deleted the bin/obj files but still can't debug. The error's i'm getting are: '{directory}/project.assets.json' doesn't have a target for…
Jimmy
  • 2,191
  • 6
  • 25
  • 45
3
votes
2 answers

EF Core execution time between Console app and Web api

Could anyone explain why there is a huge time execution time between the console application, which takes less than a second to execute, and the API takes minutes. Is it possible to improve ? I am using .NET 7 Web app var builder =…
Zulander
  • 648
  • 1
  • 10
  • 22
3
votes
1 answer

Identify which GRPC service subscribed is down .NET 7

I have this implementation for subscribing the GRPC stream services, but, I have to identify when one of the services goes off and calls the event to notify the UI. public async Task Subscribe() { await Policy .Handle(e…
3
votes
1 answer

Compile single c# file on command line with net6/net7 (Windows)

I have a number of tools that are more like scripts that full-fledged programs and in the olden days I would simply call the csc.exe compiler and throw the program.cs in there like this: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe …
Dee J. Doena
  • 1,631
  • 3
  • 16
  • 26
3
votes
1 answer

.net 7.0 kestrel appsettings.json configuration for unix sockets

I have an open-source service application written in c#, running on .net 7, on Linux, which exposes an HTTP service, using Kestrel, to provide some monitoring endpoints for application state and important metrics for monitoring the application. It…
dodexahedron
  • 4,584
  • 1
  • 25
  • 37
3
votes
1 answer

Optimizing SQL Server query performance with EF Core: inconsistent execution times

I'm using the latest versions of SQL Server and EF Core in my .NET 7 project. I have a table Deposits with 4 million rows. I encountered a small issue and I'd like to know how to address it. I have a very simple query: var deposits = await…
3
votes
0 answers

How to access the HttpContext in .Net 7 (as IHttpContextAccessor is deprecated)

I need to access the HttpContext from a custom component in a Asp.net Core WebApi app, and I found this page (under the point 'Access HttpContext from custom…