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
2,491
questions
0
votes
0
answers
35
views
.net core returns empty body json on Get request
Having troubles to return json .net core 6.0 C#
I'm using NewtonSoft json library
Obviously I'm doing something wrong...
using NetMQ;
using NetMQ.Sockets;
using Newtonsoft.Json.Linq;
using System.Text;...
0
votes
0
answers
14
views
How to host .NET 6 Web API as Windows Service?
I have .NET 6 Web API and want to host as a windows service on my own virtual server. I read many questions and answers and applied them, but I still get an error when starting the application (error ...
0
votes
0
answers
16
views
Razor page views with Partial (nested) views
I broke down bigger "Razor page" views into to "Partial" views.
From the main views I pass e.g. an image list to the partial view:
<partial name="/Partial/_ImageList.cshtml&...
4
votes
2
answers
78
views
How to update the value of a key in a dictionary, but only if the key already exists, without hashing the key twice?
I have a Dictionary<string, decimal> with a fixed number of entries, and I want to update many of its values frequently, but only for keys that already exist. If a key is not already in the ...
0
votes
0
answers
40
views
Upgrade .netcore 2.1 to .net 6 - Linq Query Translation Error
I have two two queries. The first one is like this.
var studentCourses = _context.StudentAcademicPathCourses
.Include(x => x.Course)
.Where(x => x.StudentAcademicPathId == ...
0
votes
0
answers
15
views
Mediatr Notification not being handled
I am trying to setup mediatr notification handlers where I seem to find my self in a pickle.
I am registering the notification and the notification handler in the DI container, but whenever I fire the
...
0
votes
0
answers
16
views
Google App Engine Standard environment .NET 6
While .NET6 already be supported by AWS (Lamda) Function and Azure Function.
Do anyone know is GAE will able to support .NET6 in standard environment.
(I know GAE already supported in flexible ...
0
votes
0
answers
6
views
It is possible to automate deployment of .Net6 lambda functions using the serverless framework?
I'm stuck... I've 4 lambda functions deployed to the aws console and the package is too large so only way to access the source code is to export it as deployment package. How can include this packages ...
0
votes
0
answers
20
views
Hot Reload not working in Blazor Server .NET 6
My Issue
I am using Visual Studio Professional 2022 version 17.2.5 and I have a Blazor Server project, targeting .NET 6, where the Hot Reload feature is giving me a headache. This feature works fine ...
0
votes
0
answers
6
views
Export .Net 6 Lambdas and create serverless application using SAM or Serverless Framework
I'm new to .Net 6. I've 4 lambda functions deployed to AWS + A step functions workflow I've created to orchestrate them. 2 Questions I've:
Is the serverless framework compatible with .Net 6 runtime ...
0
votes
0
answers
35
views
Is the Enumeration class a good way to represent database data in code?
For the application I am currently working on we need a way to represent the Permissions that live in the database in code so that we are able to perform various actions throughout the request ...
0
votes
0
answers
10
views
Minimal API-version returns 200 OK while Controller-version returns 500 Internal Server Error
I've built a REST proxy for a client using .NET 6, but it is not behaving as expected. I started building it using Minimal API since I've been wanting to try it out, but eventually migrated the code ...
0
votes
0
answers
41
views
How do I authenticate to an API with a clientID and secret in a .NET Core 6 console application?
I am still very new to programming in .net. I am trying to write a simple console app to test some endpoints in our scheduling software. They provide the following on how to authenticate to receive a ...
0
votes
0
answers
26
views
CollectionView SelectionChange event not working properly in Android (.Net MAUI)
I'm trying to create custom tabs control in .Net MAUI, for that, I had first tried it with ScrollView and BindableStackLayout control but in that, I'm facing a problem.
Reported here Custom tabs with ...
0
votes
0
answers
18
views
<proj>.exe.config - is there a correspondent thing in .net6 for WinForms?
I used to program WinForm .net Framework Applications. There I used the .exe.config (via "Settings" - Scope "Application" in VS).
With that, I could change the entries of the ....
0
votes
0
answers
10
views
Ensure finalizing iHostedServices before recycling on a IIS with dotnet core
I have a dotnet 6 application with an hosted service that runs some scheduled tasks all x-minutes. So far so good, everything working almost perfectly. What I get from time to time is, that the app ...
1
vote
1
answer
41
views
Could not load file or assembly 'Microsoft.SqlServer.Server'
I am trying to make a simple insert into my sqlserver database using Dapper. This is my code:
using var db = DbContext.CreateConnection();
db.Open();
string sqlQuery =
...
0
votes
0
answers
15
views
How does backwards compatibility work in the newer .Net (6+) runtimes?
I've just started work on a .Net 6 WPF desktop application (actually migration of a 4.x solution), and I've noticed that installing VS2022 has also installed .Net v6.0.6. (For consistency I'm also ...
0
votes
0
answers
23
views
Dynamically generate a ProjectReference for each match of **/*.csproj in an SDK-style solution
I have a .net 6 class library project (csproj). I want this project to have a <ProjectReference> dependency on each other project in the solution it sits in.
Why am I doing this? Because I want ...
0
votes
0
answers
23
views
HashIds not working after adding custom Output formatter
I am using Hashids library (https://hashids.org/net/) in my .NET 6 API to encode int values into string values in my model before sending it off to the API caller. The library is currently working ...
0
votes
2
answers
41
views
HttpClient Get with file in body
I have to call an external API via a HttpGet that requires me to send a file in the body. I realize that this is a bad API design but since it's external, I have no influence over it and cannot change ...
1
vote
0
answers
34
views
Inexplicable random "000000" Guid values in fake method - FakeItEasy in .Net 6
So I have this fake object definition, that has a fake method in it :
// Note: This is a simplified version of my code.
// If it turns out that such issues could come from complex method prototypes,
...
0
votes
0
answers
9
views
.net 6 Web App Update the value of the current cookie
I want to update the value of the cookie available in the browser, but I am getting the error as below. How do I update the value of the current cookie?
[HttpGet("[action]")]
public ...
1
vote
0
answers
20
views
Blazor Drag and Drop broke between .NET Core 3.0 and .NET 6.0
I followed Chris Saintys demo for drag and drop which was very clever. The source can be downloaded from his git. I added the polyfill to make the example work on mobile.
<script id="...
0
votes
1
answer
32
views
.NET 6 asp-validation showing nothing after custom error created
I am intending to pass a custom error that is generated in the controller, the custom errors are working in other files but not in this one, can't find the reason.
This is the line where I declare the ...
1
vote
1
answer
29
views
Try to display a int through a static field, but return a weird value (C#)
I'm trying to cut down on how much duplication I have on my code, so I decided to make one of my classes a static class since I decided that its data should really be shared with everyone. Here's the ...
0
votes
0
answers
20
views
Write Dbfunctions in .Net 6
Converting some code from .net4.8 to .net 6. Does anyone know how to write Dbfunctions for .Net 6? So far everything I'm seeing say to use SqlFragmentExpression and SqlFunctionExpression but these are ...
0
votes
1
answer
29
views
How to resolve "Permission denied" on .NET6 in EKS?
I am new to AWS EKS but I am trying to deploy a sample WebApp using .NET6. However I get the following exception when I check the pod logs
Microsoft.AspNetCore.DataProtection.Repositories....
0
votes
1
answer
16
views
google geocoder (reverse geocoding) WaitingForActivation
I am trying to reverse geocode some coordinates using .net6. I am using the googlegeocoder with a google's api.
I am hiding the API key for security reasons.
IGeocoder geocoder = new ...
0
votes
1
answer
42
views
What Benefits Does TimeOnly Have Over TimeSpan?
TimeOnly was one of the new types introduced with .Net 6 along with DateOnly. I understand the great need for the DateOnly type as there are many instances you would want to store a date without a ...
0
votes
1
answer
41
views
EF Core: Linq, Where with object list does work [duplicate]
I have Database Table with a composite primary key, so want to check if both key pairs are matching
public async Task<IList<AccountingAccountCategoryMap>> GetList(IEnumerable<...
1
vote
1
answer
26
views
OpenAPI Generator (C#, .NET6) - Extremely slow http requests under certain conditions
I used OpenAPI Generator to generate a C# client for the Thingsboard REST API.
I then used this client to build an application for automatically creating devices and writing telemetry data into ...
0
votes
1
answer
43
views
c# .net 6.0 I can't leave cookies
I am sending username and password by react for login process. If the username and password are correct, I want the user's browser to set the token as a cookie. but it doesn't throw.
[HttpPost("[...
0
votes
0
answers
16
views
Upload file using Ajax MVC .NET 6
I need to upload an image (single) to the server using Ajax.
Action will call the post Method on my API controller.
Up to this point, I found only outdated and broken solution like this :
https://www....
0
votes
2
answers
27
views
React Axios Request failed with status code 400
I'm trying to connect to the api with axios, but it gives 400 error. how do i solve it?
Api
[Route("api/[controller]")]
[ApiController]
public class UserController : ...
2
votes
2
answers
55
views
Logger becomes disposed between Startup and ConfigureServices
I've created a logger which should log anything during start of application run. And I wanted it to persist between Startup and ConfigureServices. I store it in the property similar to configuration
...
-2
votes
1
answer
55
views
Is ICollectionView supported by .NET 6 or is there an alternative for filtering lists in MVVM?
I’m writing a WPF app using MVVM, entity framework and .NET 6. I have a list view control in my View that I want to bind to a collection in my corresponding View Model. I want to be able to filter the ...
1
vote
1
answer
64
views
The framework 'Microsoft.AspNetCore.App', version '6.0.0' (x64) was not found
I've recently upgraded from .net5 to .net6 and in my services (not using aspnet), I am getting this error when it tries to start up.
It was not possible to find any compatible framework version
The ...
0
votes
1
answer
45
views
How to resolve NuGet "The package integrity check failed" errors?
My development environment is as follows:
Windows 10 Enterprise 64-bit
Visual Studio 2022 Professional
.NET 6.0
I am new to using NuGet. I am having constant problems with NuGet not being able to ...
0
votes
2
answers
57
views
Getting null error when reading configuration from appsettings.json in asp.net core
I created a simple ASP.NET Core 6 MVC application in which I am just reading values from the appsettings.json file.
In my appsettings, I created two sections SectionA and SectionB:
{
"SectionA&...
0
votes
0
answers
9
views
Run .Net Framework 4.8 dll in .Net 6
I am migrating my application from .Net 4.8 to Net 6.0. During the migration, I found some libraries that I could not find alternatives in .Net 6.
Is it possible to run .Net 4.8 dll in .Net 6?
If it ...
0
votes
1
answer
38
views
ASP.NET Integration test override authentication still calling other auth handler
I have the following setup where I have two potential authentication schemes in my web api. They are used for different controllers and use a different auth method. I define them here:
//startup.cs
...
0
votes
0
answers
45
views
.Net maui: MVVM How to catch a return from a different page using shell navigation
I have set up a mainpage - detail page navigation using the Shell GoToAsync navigation
[RelayCommand]
public async void SelectionChanged() //Friend friend
{
if (SelectedItem == null) return;
...
1
vote
0
answers
29
views
.net Maui Getting an: [System] A resource failed to call close
When I run the following code I get an:
[System] A resource failed to call close.
[RelayCommand]
public async void ImportData ()
{
IsBusy = true;
Console.WriteLine("Import data")...
1
vote
3
answers
64
views
Object Creation in .NET 6
Is there a difference between creating an object like this
var list = new List<string>();
or
List<string> list = new();
in .NET 6?
Both create a list but are there any benefits of using ...
-1
votes
0
answers
24
views
ASP.net MVC after fetch rendering the view does not work
I need a javascript library to perform an operation. After performing the operation I want to pass the result to the controller so I can pass the data inside a model to the view.
The thing is that ...
-1
votes
0
answers
16
views
VB.NET 2022 .net6 download image from httpstream [duplicate]
I have a program that makes an API call.The remote server returns an image (stream)
I use that image (a map) in a picturebox. It works, but VS2022/.NET6 is protesting. WebClient is obsolete, so I try ...
0
votes
0
answers
26
views
How do I override a nuget package circular reference
I have 2 solutions.
Main
Which builds an assembly: Main.DomainTypes.dll (this will get packaged as a nuget package)
External
Which builds an assembly: External.EventTypes.dll (this is also ...
0
votes
1
answer
47
views
Setup database context using .NET Core 6.0 from appsetting.json file
I am working on an application where I need to add migrations but it says unable to add migrations. I am registering startup.cs but CreateDefaultBuilder doesn't contain definition of ...
-1
votes
0
answers
33
views
Controller not rendering the view
I am trying to return a view from a controller. If I am typing the url to the view it is working fine but if I try to access it through the code I access the controller method but nothing happens.
The ...