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
3
votes
0 answers

EFCore 7 TPC Strategy with abstract User class

I'm working on a university management web app that I'm trying to make for a school project. Currently I have 3 classes in my project as follows: public abstract class User : IdentityUser { public string FirstName { get; set; } …
3
votes
2 answers

Is there something similar to NotNullIfNotNullAttribute for IEnumerable return values?

(This is a question about C# nullable reference types and generics.) I know that I can use NotNullIfNotNullAttribute to specify that the return value of my method may be null if, and only if, an input is null: [return:…
Heinzi
  • 167,459
  • 57
  • 363
  • 519
3
votes
2 answers

Downloading file from Azure blob storage via Memory Stream

I currently have an endpoint in my .net 7 API that when hit, should download a specific file from my blob storage by using the file name. When I test out the endpoint I get a 500 error stating "Time outs are not supported in this stream". I have…
svalaie
  • 73
  • 7
3
votes
1 answer

ASP.NET Core 7 MVC project Area folder empty

I just created an ASP.NET Core 7 MVC web project with local identity in Visual Studio 2022. Once I have done the migration of the database, now I can register/login, but I am surprised I can not find identity related code files in directory…
SJj
  • 31
  • 4
3
votes
1 answer

.NET - What's the point of the JsonNode GetPath() method?

I'm using the System.Text.Json package to work with/manipulate JSON and I've got a niche scenario where I can potentially reuse a method if I can provide it with a path to access the value of a node. I noticed the JsonNode class has a GetPath()…
3
votes
1 answer

Bug with IndexOf in .NET 7.0 with non-spacing characters?

I'm seeing a weird issue with .NET 7 with the string APIs IndexOf and Contains. I'm using C#. To repro: ("Foo" + (char)1618).Contains("Foo") returns true .... yet ("Foo" + (char)1618).IndexOf("Foo") returns -1 1618 is a non-spacing Unicode…
Dan
  • 55
  • 2
3
votes
2 answers

Project EF Core 7 result to named tuple

I'm using EF Core 7. I want to perform server evaluation and project to a named tuple. I tried: var products = await _context.Products.Select(x => (x.Id, x.Name)).ToListAsync(); Which gives: An expression tree may not contain a tuple literal. I…
lonix
  • 14,255
  • 23
  • 85
  • 176
3
votes
1 answer

.NET Core 7 Minimal API MediatR IRequest Handler mapping error

I am currently getting the following error when executing a command via .NET Core 7 Minimal API: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1] An unhandled exception has occurred while executing the request. …
dmeadley
  • 77
  • 5
3
votes
1 answer

How to recreate or refresh an access token for database connections in Azure functions?

I am trying to use an Entity Framework database context for use with managed identity credentials in an Azure function. I have been able to establish a database connection. The issue is that I am not able to keep the database connection established…
3
votes
2 answers

Why is Group By translating in Order By by Entity Framework?

I am using Entity Framework in .NET 7. I have 3 entities: Course that contains a ProfessorId among other things Grade that has a CourseId among other things Professor I want to get all the courses that are assigned to a professor and have at least…
StyleM
  • 138
  • 1
  • 5
3
votes
2 answers

'Type' cannot satisfy the 'new()' constraint on parameter 'TParam' because 'Type' has required members

I have this class structure (simplified): public class InducingMedium { public required string File { get; set; } } public class InducingVideo : InducingMedium {} public class InducingAudio : InducingMedium {} Now, I want to generically…
Mr Patience
  • 1,564
  • 16
  • 30
3
votes
1 answer

How to set up a .NET 7 C# rate limiter per user if the user id is stored ONLY in the entity in the request body?

There is an API that accepts an entity with a previously unknown ID. I need to configure the rate limiter so that entities with the same ID get into the queue. I figured out how to create a window and a queue. How to make a separate queue for each…
3
votes
1 answer

Is it possible to run .NET Framework WPF application with .NET 7? (Windows 10)

I'm working on a WPF project that targets .NET Framework 4.8 1/ Now I'm researching about running that application with .NET 7 but is it possible to do that? For example, I tried dotnet wpf.exe but it shown some errors A fatal error was encountered.…
IFZR
  • 316
  • 1
  • 12
3
votes
1 answer

Open Telemetry with .Net 7 minimal api - AttachLogsToActivityEvent not working with 'IncludeFormattedMessage'

I am using 'OpenTelemetry.Contrib.Preview' package to attach ILogger standalone logs as Activity Events (aka Trace events) to co-relate the logs with trace & show at a single place like Jaeger. As part of the documentation if we want to attach the…
SanjayD
  • 156
  • 4
  • 12
3
votes
1 answer

Why does the onclick event not work, in my razor pages hosted blazor component, in .net 7.0?

This code has been working just right in a blazor web assembly, embedded in a razor pages page, using .net 5.0 and .net 6.0. I had to upgrade to .net 7.0, by altering the framework in razor pages and blazor projects' properties, to fix a big…
sanepete
  • 979
  • 9
  • 28