Questions tagged [.net-6.0]
For questions about Microsoft's .NET application development framework that are specific to version 6.0+ of the framework. Use only If your question are version-specific
.net-6.0
5,914
questions
0
votes
1
answer
30
views
Unable to send a local image that isn't under wwwroot to openai using its new .NET library
I have an ASP.NET Core 6 Web API with the new official library from OpenAI (https://github.com/openai/openai-dotnet).
What I'm trying to do, is to use a local image file to OpenAI. The file isn't ...
0
votes
0
answers
26
views
Any pitfalls in upgrading a WPF application from .Net 6 to .Net 8?
We're looking to upgrade some large WPF solutions from .Net 6 to 8, and my understanding is that the process should be straightforward (changing the projects' target framework). But are there any ...
0
votes
0
answers
42
views
Populate a many to one relationship and how to show data input only once but increment if the date in the input are the same
I am currently working on a web project that required user to input a group of value for each person in a department per day then display it in two other index for day and month. I'm having problems ...
-1
votes
1
answer
46
views
C# WPF Change Text Event From TextBox
i have a problem. I made a new class called "LetterBox" this class inherits from TextBox everything is working for now. But here comes the problem: I need the Event or Function that "...
0
votes
1
answer
29
views
Can't load System.Net.WebHeaderCollection
.net 6.0 project, it throw the exception can't find a dll version 6.
this is the error:
System.AggregateException: One or more errors occurred. (Could not load file or assembly 'System.Net....
0
votes
0
answers
20
views
AsyncWebserver_Teensy returns invalid status line
Problem
My teensy is connected to 4 Serial devices and I use the Webserver provide access to them over a local network. I have a Raspberry Pi that is requesting data from the Webserver in multiple ...
0
votes
1
answer
75
views
403 from Azure only in a specific endpoint with specific version of the API
We developed a middleware service Web API app in .NET 6 with several endpoints and deployed it to Azure. We get a strange error with an endpoint that implements a POST method.
If we change the version ...
0
votes
3
answers
84
views
How to let HostedService run after host started?
I have a .NET 6 console app.
Program.cs code:
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System.Threading;
using ...
0
votes
0
answers
33
views
In one of the cshtml files,namespaces can not be found
I am using visual studio 2022 .net 6. All the other cshtml files within the same project are not showing any issues. Only in one cshtml file, the namespaces are not able to be found. All the ...
0
votes
1
answer
51
views
How to populate CreateGroupViewModel
I'm having trouble with inputting value into a ViewModel as it keep returning null after the value is inputted via cshtml.
Value I input in cshtml
After hitting confirm
CreateViewModel.cs
public ...
0
votes
0
answers
31
views
I am trying to use gRPC between .NET 6.0 as a service and .NET 4.7 as Client side. I am getting an error on the Client side it doesnt support HTTP2
I have a solution built on .NET 6.0 and I want to use its functions from another solution restricted to .NET 4.7. I am getting an error when using GRPC on the client.
The first trial was on .NET 6.0 ...
0
votes
0
answers
25
views
How to version web models and service layer in .net 6.0 API? [closed]
We recently started writing REST API in our API project and implemented API versioning using asp.versioning package. We are currently only versioning controllers and service layer. The problem is with ...
0
votes
0
answers
62
views
Microsoft.AspNetCore.Server.Kestrel.Core vulnerability issue - fix
what is the latest version of "Microsoft.AspNetCore.Server.Kestrel.Core" in the series of 6 like Version="6. * . *" In nuget gallery it is not available any thing later than v2.2.0
...
0
votes
0
answers
48
views
BinaryFormatter exception when trying to Get non-existing preference key in SettingsProperty in System.Configuration.ConfigurationManager
using System.Configuration;
var provider = new LocalFileSettingsProvider();
var context = new SettingsContext();
var attributes = new SettingsAttributeDictionary();
var attr = new ...
0
votes
1
answer
84
views
How does ObservableCollection/INotifyPropertyChange work when object is changed
I have a situation where in one view model some properties on an object are updated. In another view model, I subscribe to a message and then update a collection with this new object, e.g.:
...
0
votes
0
answers
20
views
How to use the intelmkl.redist.win Nuget package in an .NET 6 project with Excel.DNA?
I am working on a .NET 6 project and using Excel-DNA (version 1.8.0). I want to integrate some functionality from Intel MKL. Intel provides a NuGet package for redistributing the native libraries, ...
0
votes
1
answer
37
views
How to create a custom object from a register page
I want to create a Department object that doesn't exist yet an assign it a AppUser along side a Person object then add it to database during the registration process with .net 6.0 ef identity ...
0
votes
0
answers
29
views
ASP.NET Core 6 Web API : password popup on new server
We are moving to a new Windows Server 2022 and when using Swagger, some users are experiencing a popup window asking for username and password when trying to run an operation. Others are able to run ...
0
votes
1
answer
52
views
WebOptimizer cache busting not working on Azure
I am using ASP.NET Core Web Optimizer. It has cache busting feature that will append a unique string to the end of script or CSS links.
A sample of the appended string is like this: ....script.js?v=...
1
vote
1
answer
40
views
How to insert a custom object into an User using foreign key
I'm currently having problem with displaying a custom object property because the program doesn't seem to insert the associated value from the table with appropriate foreign key.
Here are the codes
...
1
vote
1
answer
61
views
Rebuild skip all project in Visual Studio 2022
I do not understand why Visual Studio skips all the projects to do rebuild of the solution.
The output console only shows that the projects were skipped.
I have tried deleting the bin, obj and .vs ...
0
votes
1
answer
41
views
How to use razor renderer in .NET 6?
In my .NET 4.8 Web API application, I take an externally received HTML formatted string and convert it to a .cshtml file using Razor Engine, then append it to my page with JavaScript. I do this using ...
0
votes
2
answers
85
views
Need help to replace a switch in C#
I have a console application in .NET 6 that receives one argument, and based on that, has to decide which operation will be executed. At first, I had all the operations as static methods and ...
0
votes
2
answers
46
views
How to use Enumerable.Aggregate without getting CS0411 error
There are two DTO records:
public record struct DateHour(int Hour, double? Value);
private record struct HourSnapshot(uint TotalSeconds, double? Value);
I have another method which works with enum. I ...
0
votes
0
answers
61
views
Found multiple publish output files with the same relative path. while publising ASP.NET Core 6 project
In .NET Core 6 where when publishing with Web Deploy via Visual Studio 2022, I get the following error:
Error: found multiple publish output files with the same relative path:
There is no issues ...
0
votes
1
answer
23
views
AppKit.NsWindow error on .NetMAC OS application after migration from Xamarin.MAC
I have Xamarin.MAC native application built with C# language. Since the Xamarin support is stopped, I have to migrate it to .Net MAC OS. But I am not seeing the AppKit.Window in the .Net MAC OS. In ...
1
vote
1
answer
63
views
Is it possible to use ProtectedLocalStorage without regular .NET Core?
Seems like an obvious upgrade from regular localstorage, but I've only seen it used with Blazor.
I'm using ASP.NET Core 6.0 MVC.
Should I just put this in my program.cs?
builder.Services.AddScoped<...
0
votes
0
answers
61
views
ASP.NET Core 6.0 Web API : cannot context switch to another account to start an executable
I have an ASP.NET Core 6.0 Web API that runs on IIS 7. The application pool is running under an account local to the machine but not the local system, call it 'local-system-web-account'. I am trying ...
1
vote
1
answer
49
views
Unexpected System.BadImageFormatException: Index not found That is Fixed with Restart
I have an ASP.NET Core 6 MVC web application hosted on IIS that all of a sudden started throwing the following exception:
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of ...
-1
votes
1
answer
53
views
EntityFramework pretends to have updated a row but it doesn't
I wrote an InsertOrUpdate() method which uses my EntityFramework dbcontext and I want the method to be able to receive an object and then either insert a new row or update an existing one if it exists ...
0
votes
0
answers
42
views
.Net 8 Project Reference Specify .net Version of Multi-Targeted Transitive Project Dependency
I have a .net6 sdk project that I need to upgrade to .net8 for some new functionality. It has some shared project libraries with other projects that are still .net6.
Project A includes Project B which ...
0
votes
0
answers
25
views
How to Display Dictionary<string, string> Properly in Swagger UI using NSwag
I am using NSwag to generate Swagger documentation for my API. One of my API endpoints uses a Dictionary<string, string>, but in the Swagger UI, it is displayed as a generic object. Instead of a ...
-1
votes
0
answers
49
views
Visual Studio Professional 2022 not loading dlls after updating it to subversion greater then 17.10.1
I am facing an issue in Visual Studio Professional 2022 (17.10.3).
Actually IIS express not treated my project as an Application.
Also NO Dlls were loading while running the application.
No ...
0
votes
0
answers
36
views
How can I authorize and endpoint with multiple policies and use an RoleAuthorizationHandler? in c# .net 6
How can I authorize and endpoint with multiple policies and use an RoleAuthorizationHandle?
This is my setup right now. These are the policies that are defined in the ServiceCollectionExtensions:
...
0
votes
1
answer
74
views
Setting C# language version used by Docker to build my project
I have a net6.0 project with <LangVersion> set to latest, allowing us to use latest C# features (I realize now this is probably bad practice?).
It all builds fine from within Visual Studio, but ...
0
votes
1
answer
38
views
Minimal API Swagger doc keeps returning 404 when published to IIS
I have an ASP.NET Core 6.0 Minimal API. When I run it in IIS Express from VS, Swagger works just fine, but I want to publish it to IIS on my device so I don't always have to run it from VS.
Problem is,...
0
votes
1
answer
36
views
Awaiting ClientWebSocket.ReceiveAsync only receives one packet of information, and then all other awaits never return
I'm using the System.Net.WebSockets.ClientWebSocket class in C# on .NET 6.0.
I have a timer set up that repeatedly will poll the websocket for connections, shown here. The timer is elapsed every 16 ms....
0
votes
1
answer
52
views
Ignore validation error when calling .NET framework WCF service from a .NET 6.0 project
I have a .NET framework 4.8 project, which is calling a .NET 4.8 WCF service. I want to use https, but for now I have only self signed certificate, thus I simply ignore all validation errors:
...
0
votes
0
answers
22
views
I logged in with Identity Server4 and I change subdomain, I want to stay logged in - .NET Core and Angular
In .NET Core 6 using Identity Server 4 password flow, Angular, I log in successfully using a valid user name and password and store the token to local storage.
Now I want to allow logged in user to ...
0
votes
0
answers
45
views
Inconsistent CORS errors in React UI calls to ASP.NET Core 6 Web API
A React app is calling my ASP.NET Core 6 Web API. Things have been working fine for months with no CORS problems.
Starting this week, I started seeing the React client unable to call the API ...
1
vote
2
answers
60
views
Handling a comma inside a cookie value using C# and .NET 6
I encountered an issue while trying to read the content of a third-party cookie.
The cookie contains values like: 110, IN, ABC, X, Y,,,,,
I'm reading the cookie using:
_httpContextAccessor.HttpContext....
0
votes
0
answers
97
views
CVE-2023-36049 System.Net.Requests net6.0
I use syft and grype to find vulnerabilities "CRITICAL and HIGH" in my "net6.0" solution.
Grype found the vulnerability CVE-2023-36049
https://github.com/advisories/GHSA-c3hf-8vgx-...
0
votes
1
answer
29
views
Authorization issue in Azure Function (InProcess) .Net 6.0, anyone used nuget package DarkLoop.Azure.Functions.Authorization.InProcess/4.1.0
I have azure function developed using .Net 6.0 InProcess mode. I have used below code for Authentication but its not working now with lastest runtime on azure portal.
Azure functions are not loading ...
0
votes
1
answer
48
views
"System.Management currently is only supported for Windows desktop applications" error when dynamically loading a DLL in .NET 6
I'm using the "Microsoft.Windows.Compatibility" package to get the baseboard serial number in a .NET 6 application. My code looks like this:
var searcher = new ManagementObjectSearcher("...
0
votes
1
answer
36
views
How do I use Chrome API Sidepanel in a Blazor extension?
Currently I am trying to get my browser extension to utilize the Chrome API's SidePanel.
I have used this method in a react application, but I am stumped getting it to work in Blazor.
BackgroundWorker....
1
vote
0
answers
57
views
Executing PowerShell scripts from C# .NET 6 web app using RunImpersonated not working - Scripts still execute as IIS APPPOOL\APP
My app needs to execute PowerShell scripts to create and manage AD accounts. My current setup uses HangFire to launch background jobs, PowerShell execution being one of them. I have an ...
0
votes
0
answers
26
views
EF Core discriminator generates incorrect FK migration
I have inherited a database where the structure is like this:
Table:
CREATE TABLE `address` (
`addressId` int NOT NULL AUTO_INCREMENT,
`addressType` int NOT NULL,
`instanceId` int NOT NULL,
`...
0
votes
0
answers
30
views
Fortify flaging .Net6 API returning File from internal server vulnerable to XSS attack
using (HttpClient client = new HttpClient())
{
string FindDocumentURL = string.Concat(internal server URL builder);
response = await client.GetAsync(FindDocumentURL);
if (response....
0
votes
1
answer
43
views
Trouble posting contents of file input to controller action using jquery in ASP.Net Core 6.0
I am attempting to post a file to a controller action in order to save it, and have run into two different problems, when using $.post to post the data as shown here:
$("#setting-form").on(&...
0
votes
0
answers
66
views
.NET 6 upgrade to .NET 8 using OIDC is now throwing error: "An invalid request URI was provided."
I have a fairly standard .NET 6 app that is using cookies for DefaultScheme and OIDC for the challenge scheme. I didn't change the registrations for either, I simply upgraded from .NET 6 to .NET 8.
I'...