For questions related to Microsoft's .NET application development framework that are specific to version 8.0+ of the framework. Use only If your question are version-specific. For generic .Net framework related questions use .Net tag. Keep it in mind that .Net 8 is still under pre-release/preview.
Questions tagged [.net-8.0]
29 questions
2
votes
1 answer
How to add .NET 7++ to Visual Studio 2022++ as target framework?
I just installed the .NET to my machine. Yet, Visual Studio 2022 doesn't list the new SDK in its list of target frameworks:
In Visual Studio Installer there is no ".NET 7 Target Framework" option to check.
How can I get Visual Studio 2022 to list…

AxD
- 2,714
- 3
- 31
- 53
2
votes
5 answers
How to fix "The analyzer assembly references version '4.7.0.0' of the compiler, which is newer than the currently running version '4.6.0.0'."
I opened my Visual Studio 2022 project this morning and cannot get it to run any more due to the following error:
CS9057 The analyzer assembly…

Tyson Gibby
- 2,590
- 2
- 18
- 37
2
votes
2 answers
.NET 8 - C#12 - preview try interceptors
I would like to try the new C# 12 preview function Interceptors but can't seem to get them to work.
The page says
Preview feature Introduced in Visual Studio 17.7, preview 3.
So I tried using Jetbrains Rider. Because I have seen Nick Chapsas…

Connor Stoop
- 1,574
- 1
- 12
- 26
1
vote
1 answer
The type initializer for 'Microsoft.Extensions.Logging.EventSource.LoggingEventSource' threw an exception
I a running the dotnet 8 preview 7 and I keep getting the below error message when I make a call to Host.CreateDefaultBuilder().
Stack Trace
Could not load type 'System.Runtime.CompilerServices.NullableContextAttribute' from assembly…

Dblock247
- 6,167
- 10
- 44
- 66
1
vote
1 answer
Razor Pages only render when using RuntimeCompilation .NET 8 Preview 6
I experience some strange behaviour. When using the standard ASP .NET 8 (or .NET 7) Web App template, the template does not render (or the route is not recognized) unless I use RuntimeCompilation - and I don't want to.
In the browser I'm presented…

Lindstrøm
- 396
- 2
- 16
1
vote
0 answers
LibraryImportAttribute incorrectly stating use of extension method and preventing compilation
I am using .NET 8 Preview 6 and Visual Studio 2022, updated today.
I updated a library today, changing from DllImport to LibraryImport, but it indicates CS0755.
Here is my imported method declaration:
public unsafe static partial class…

IamIC
- 17,747
- 20
- 91
- 154
1
vote
1 answer
ASP.NET Core JWT authentication doesn't work in Docker container after migration
ASP.NET Core JWT authentication stopped working after upgrading ASP.NET Core Web API from .NET Core 3.1 to .NET 8 (v8.0.100-preview.5.23303.2) when running in Docker container.
The JWT token generated by another service that I don't have access to…

Ikhwanul Labib
- 21
- 4
0
votes
1 answer
Make record JSON-convertible as `string` in SwaggerUI
I have a record that implements string conversion:
[JsonConverter(typeof(ExamplePropJsonConverter))]
public record ExampleProp
{
private string? Value { get; init; }
public static implicit operator string(ExampleProp value) =>…

filimonic
- 3,988
- 2
- 19
- 26
0
votes
0 answers
Cannot run apps because of .Net 4.x
After restarting my computer. Everything suddenly are unable to run, a lot of applications was affected including VS2022 and SSMS. Giving me error that the application is requiring a .Net of specific version. Tried installing .Net 4.8 but blocks me…

Ryan G
- 71
- 1
- 11
0
votes
1 answer
Cannot find FromKeyedServices
I'm using a new .Net 8, and I'm trying to inject some service with a new way of keyed services, but unfortunately i cannot find FromKeyedServices, is not found, it's belong to Microsoft.Extensions.DependencyInjection namespace, i added this but…

Oleg Pro
- 47
- 5
0
votes
0 answers
Prometheus scrapes metrics only from HomeController
I am trying to implement new metrics in my ASP.NET Core MVC application using .NET 8 and new OpenTelemetry (1.6.0-rc.1).
All works fine except 1 problem - for some reason my application expose only metrics from HomeController, and no metrics from my…

Nikita
- 1
- 1
0
votes
0 answers
System/Microsoft.Data.SqlClient is not supported on this platform .NET 8
I'm upgrading a Blazor Server app (.NET 5) to WebAssembly and .NET 8, and moving it from on-site to Azure. In the process of upgrading it, I started getting the error :
System/Microsoft.Data.SqlClient is not supported on this platform (I tried…

jnelson
- 41
- 1
- 10
0
votes
0 answers
GRPC JsonTranscoding + gRPC web in Blazor WASM
It seems that Blazor WASM does not allow a reference to a project having 'Microsoft.AspNetCore.Grpc.JsonTranscoding' installed. So my question is: (how) can GRPC JsonTranscoding and gRPC web be combined?
Some context:
I have a gRPC API with HTTP…

HdG
- 53
- 7
0
votes
1 answer
TypeLoadException: Could not load type 'System.Runtime.CompilerServices.NullableAttribute' from assembly 'System.Runtime, Version=8.0.0.0,
I upgraded my Blazor server project to .Net 8 and get this error:
System.AggregateException: 'Some services are not able to be constructed'
TypeLoadException: Could not load type
…

mz1378
- 1,957
- 4
- 20
- 40
0
votes
0 answers
Error CS9057 in analyzer Microsoft.NET.Sdk.Razor.SourceGenerators.dll
I have created a new project on** 8.0.0-preview.6.16**
When I build the project, this error appears:
Error CS9057 The analyzer assembly 'C:\Program…

Alaa Barakat
- 31
- 4