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.
1,248
questions
0
votes
0
answers
16
views
Google authentication .Net 7
How do i migrate this .Net 5 code to .Net 7:
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(jwt => jwt.UseGoogle(
clientId: &...
-1
votes
0
answers
42
views
How to try serialize and deserialize object as filepath
Is there a way to write a custom serializer and deserializer that takes an base type and tries to convert it to and from a string value?
On serialization I want it to see if it was previously ...
0
votes
0
answers
20
views
Hangfire Failing To Build For Integration Test
I am new to integration testing. My .Net 7 WebApi uses Hangfire and it is failing to build when the CustomWebApplicationFactory is called. I am using xUnit to do the tests.
public class ...
2
votes
1
answer
55
views
HTML Agility Pack not matching xpath where attribute name starts-with
I am trying to select all HTML nodes where the node contains an attribute with a name starting with 'on'.
This is what I have for the XPath:
//*[@*[starts-with(name(), 'on')]]
I am getting null back ...
-1
votes
2
answers
43
views
GetRange of List as Reference [duplicate]
I want to get a sub-list from the list and perform an operation on it. And the result should be applied to the main list
var myNumber = new List<int>() { 1, 5, 9, 7, 2, 8, 2 };
var subNumbers = ...
0
votes
2
answers
83
views
Add attribute to all controllers
I want to add the [ApiExplorerSettings(IgnoreApi = true)] attribute to all of my controllers so that I can opt in to the behavior instead of having to opt out on most controllers. I tried adding it ...
0
votes
0
answers
42
views
EF Core 7 Data is Null. This method or property cannot be called on Null values
I have .net 7 web api and EF Core 7.0.11 and I'am trying to get operator object from DB by
login column (nvarchar(100), nullable).
List<Operator> op = await _dbContext.Operator.Where(w => w....
0
votes
0
answers
44
views
HTTP Error 500.32 - ANCM Failed to Load dll
I have upgraded a .NET Core 2.1 web app to .NET 7.
The application works fine on Visual Studio 2022.
When I deploy that to Azure through Azure DevOps pipelines, I get the following error:
HTTP Error ...
0
votes
0
answers
24
views
Problem generating PDF with iText7 version 8.0.1 in a .NET 7.0 Web API
This is my code
[HttpGet("generar")]
public IActionResult GenerarPdf()
{
// Create a new MemoryStream to write the PDF into it.
using (MemoryStream stream = new MemoryStream()...
0
votes
2
answers
23
views
partial not discovered from identity area
Working on a asp.net core web app. I have moved a partial from the /Views/Shared folder to a subfolder /Views/Shared/MenuPartials.
The Identity has been completely scaffolded and is as code inside the ...
0
votes
1
answer
32
views
How can i get a Firebase FCM token in ios and andriod .NET Maui application? And what nuget package is the best for this
I had a Xamarin application that i migrated to .net7 Maui, currently having issues implementing Firebase push notifications, I did use a package: Plugin.Firebase but that completely broke my project, ...
-1
votes
1
answer
31
views
Method not found: Void RestSharp.RestClient..ctor(System.String) [duplicate]
My .Net 7 C# application is given this error.
Sometimes it's not happend
logcenter log:
System.MissingMethodException: Method not found: 'Void RestSharp.RestClient..ctor(System.String)'.
at ........
0
votes
1
answer
43
views
Understanding EF Core SQL query translation
I have questions, regarding EF Core translation, is this query already optimized?
SELECT
e."EmployeeId",
e."PositionId",
t."Name"
FROM
"Employee"...
0
votes
0
answers
13
views
How to use ReactiveUI events in avalonia?
If I make a new project with the latest Avalonia, and try the following code:
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this....
0
votes
1
answer
67
views
ServiceBusTrigger does not contain Autocomplete property
I am working with .NET 7 Azure Function app and the ServiceBusTrigger attribute does not contain Autocomplete property. I also don't see a way to import MessageReceiver to manually complete/deadqueue ...
0
votes
0
answers
13
views
How to deploy angular / .net7 web app without Azure, etc
I have Angular 16.2.3 and .net7 web application and MSSQL Server Database, everything works perfect locally i.e. on localhost.
Web application created using command dotnet new angular from terminal.
I ...
0
votes
0
answers
43
views
Newtonsoft - Serializing and deserializing objects with backing objects and fields
I'm trying to serialize and deserialize this object from my azure redis cache using newtonsoft as my serializer (and fusion cache as a cache helper library). The issue is that when deserializing, the ...
0
votes
0
answers
42
views
F# JsonConverter seems to be ignored in .NET7
First of all, the problem appeared once we upgraded to .NET 7. For the previous versions, both 5 and 6 the attr worked as intended.
There is custom JSON converter:
type RouteCheckConverter() =
...
0
votes
1
answer
44
views
How to do page handler with MAUI
I am familiar with custom renderers from Xamarin Forms.
I have been able to perform two custom view handler for MAUI.
But, I am stuck with page handlers for MAUI... please help
What would be the ...
0
votes
0
answers
54
views
Better to use 6.x.x or 7.x.x Microsoft NuGet packages for .NET 6 application? [closed]
Currently doing a .NET Core 3.1 to .NET 6 migration for a project.
I've noticed a lot of Microsoft NuGet packages are at versions 7.0.0 e.g. Microsoft.Extensions.DependencyInjection.
These versions of ...
0
votes
1
answer
26
views
NSerciceBus SetMessageId actually set correlationId?
in my .Net project I need to set the MessageId of the message I send to an Azure ServiceBus Queue, so I have code like this:
sendOptions.SetMessageId(message.MessageId);
MessageSession.Send(command, ...
-1
votes
0
answers
42
views
Is there a way to view verbose logs to identify 400 errors?
I have a basic web app using the new trimmed down Program.cs
i.e. var builder = WebApplication.CreateBuilder(args);
I have multiple WebApi controllers setup, and they all work bar one. For which I'm ...
0
votes
1
answer
44
views
EF Core Property/Column Sharing
Original Question
I have the following entity I’m trying to get to work with EF Core/NET7, where two properties map to the same column. This way either property could be used in various interfaces ...
1
vote
2
answers
45
views
LogTrace and LogDebug Not Appearing in Console OR Debug Windows - Logging issue in .NET 7.0
I am managing to display logging for the following Level of logs in both the console and debug windows in my ASP.NET Core 7 MVC project.
.LogInformation
.LogWarning
.LogError
.LogCritical
However, ...
-1
votes
2
answers
74
views
WPF - Why is there no OnForegroundChanged method in Control?
I am overriding ContentControl which inherits from Control which has dep prop Foreground.. I want to run some custom logic on foreground changed event but there is no OnForegroundChanged method to ...
-2
votes
0
answers
36
views
WPF performance: binding a path from dictionary by key name vs using StaticResource
I have WPF app with large amount of "icons" represented as Paths with Key names and Shared=False, placed in a compiled resource dictionary.
They are used as <ContentPresenter Content=&...
0
votes
1
answer
15
views
Mapster - Nested Navigational Property Map
I use mapster to map my db model and dto object mapping, but i getting some projection error.
I set mapster global config like this:
TypeAdapterConfig.GlobalSettings.Default.PreserveReference(true);
...
0
votes
2
answers
61
views
Build a .NET 7 REST API to parse data from either a CSV or a JSON file
I am currently working with a codebase that is hard-coded to load data from a CSV file.
The app now needs the ability to support loading data from additional file formats, e.g. XML or JSON files.
I ...
1
vote
0
answers
26
views
Why does safari open the link from a script in index.html for a .net maui app
I am working on an app using .NET MAUI and its been great. I have a feature where the user can load their wallet using a service called paystack. For this, I have added the script to the html and ...
0
votes
1
answer
73
views
httpClient PostAsync Returning 405 Method Not Allowed
I've incorporated Payfast via their custom integration. I'm on the last step to validate the request with Payfast by making a request to the url: https://sandbox.payfast.co.za/eng/query/validate.
...
0
votes
0
answers
27
views
Blazor WebAssembly loading Issues
We have created a Blazor application with WebAssembly.
Everything worked great, and the first feedback from the beta tester was good.
Now we had a last test round, before the release and faced a big ...
0
votes
1
answer
109
views
Asynchronously wait for initialize device with timeout [closed]
I have several devices to initialize, each device will be initialized by a single task.
Sometimes the device will report errors when it initializes failure and sometimes it will become unresponsive.
...
-1
votes
1
answer
68
views
Convert Entity result to a different model
I don't really know how to describe this very well...
I want to use a model that is inherited from my entity DbSet without doing the mapping every time?
Entity database set
public DbSet<MyDataTable&...
0
votes
1
answer
17
views
Creation of the user management area in a BO by User Admin in a .Net7 MVC project with EF7 with Identity Account
I'm developing a backoffice in .net 7 with EF7, with the default MVC template and Identity account.
I would like your help both in terms of code and opinion.
In my case, I don't need any more fields ...
1
vote
1
answer
37
views
WPF MVVM app: GC releases memory after 10 minutes (not a memory leak!)
An MVVM WPF app in C# (.NET 7.0), best practices, clean code.
Observation
Initially, the application needs 200 MB or RAM. After populating lists with a lot of data, about 1500 MB of memory is used, ...
0
votes
0
answers
20
views
how to access DLLs when published using produce single file
I have a .net 7 console application which I want to distribute as a single file for future updates and automatic updates.
I have used options provided in the VS publish settings as attached image.
It ...
0
votes
3
answers
55
views
ILoggerFactory does not contain a definition for addconsole
I have upgrade a project from .NET Core 2.1 to .NET 7.
The original project had the following segment in startup.cs:
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ...
0
votes
1
answer
34
views
ASP.NET Core 7 Web API : date serialization for Angular form control
In the Person class, Birthday is defined as DateTime.
public class Person
{
public string Name { get; set; }
public DateTime Birthday { get; set; }
}
In my controller, I have an endpoint as ...
0
votes
1
answer
50
views
Transient Error: "too many connections for role" in ASP.NET Core project with PostgreSQL and Entity Framework Core
In my ASP.NET Core project, which uses PostgreSQL as the database and Entity Framework Core for data access, I'm running into a recurring problem. I'm getting the following error message on and off:
{&...
0
votes
1
answer
53
views
ASP.NET Core 7 Web API inside Blazor Server project not working
I am trying to add an ASP.NET Core 7 Web API inside the Blazor Server application, but the API is not loading.
When I go to this URL: https://localhost:44322/api/GetWeatherForecast, I see the ...
0
votes
0
answers
18
views
NSwag C# Client Not Properly Generating Azure.ETag
I have the following ASP.NET Core 7 Web API controller in C# that saves an attachment to Azure Blob Storage:
[MapToApiVersion(Constants.ApiVersions.V1)]
[HttpPost]
[ProducesResponseType(typeof(...
0
votes
2
answers
82
views
How to set Dapper connection string in the top of the application once?
I using Dapper in my ASP.NET Core 7 Web API.
I have a lot of functions looks like that:
public async Task<int> InsertTableObject(TableObject tableObject)
{
using var connection = new ...
1
vote
1
answer
99
views
Authorize with roles and multiple authentication schemes per custom default policy not working for all schemes
Question
How do I make it so that tokens for both schemes work with roles regardless of whether a "Default" scheme token or a "Secondary" scheme token is used?
At the moment, ...
0
votes
0
answers
33
views
MAUI Error APT2096 failed to open APK:Invalid file
Thanks for helping me.
I'm beginner to learn MAUI,I created a new MAUI project and without any change,just download associationed Android resources like 'Pixel 5 - API 33(Android 13.0 - API 33)'.
When ...
1
vote
0
answers
70
views
The state machine consumer does not receive the azure service bus queue
I have 2 web apps (.net 7, both are hosted in Azure App Service) and Azure Service Bus (contain some queues, with this example being order-start and order-member-start queues)
1 web app (web API) ...
0
votes
1
answer
73
views
Azure Function app .NET 7 isolated mode unhandled exception
Updated with another example.
I have an Azure Function app running on .NET 7 in isolated mode on a Linux app service plan.
I'm experiencing some issues related to a orchestration function is not ...
0
votes
0
answers
13
views
Why does the .NET 7 CLI ignore warnings on subsequent builds?
I’m building a simple Blazor WebAssembly project with .NET 7, using only the CLI, not Visual Studio. I’m wondering why .NET doesn’t continue to report the warning you see on the first build: it ...
0
votes
0
answers
25
views
Adding migration to a context in a separate class library?
I have a separate Assembly with several data types and a DBContext-derived class. It's set up to be used in several websites but each website can specify which database server to use. Choices are ...
0
votes
0
answers
26
views
Exception UnSupported media type using reset client in .NET 4.7.2 calling .NET 7 Ocelot gateway url
I have Abp project in .NET 7 and using Ocelot gateway when calling using REST client or http client. From .NET 6 it is working fine, but when calling from .NET framework, it throws an exception
...
0
votes
1
answer
29
views
Issues with .NET's configuration json serialization on a Raspberry Pi 4B with Raspbian (Debian 11)
I am writing a custom C# console program targeting .net 7.0 and running on a Raspberry Pi 4B with Rasbian after being published self-contained targeting ARM64. There is 1 property of my configuration ...