1,623,924 questions
9
votes
2
answers
236
views
Nullable warning when upgrading to extension-members syntax
I have two versions of helper methods for logging on ILogger. The first (classic extension methods) compiles fine; the second using extension members results in a compiler warning/error code.
CS8620: ...
1
vote
1
answer
64
views
Is There a Better Way to Count the Number of Columns in an Access Database Table?
I need to count the number of columns in a Table in an Access Database.
The following code does the job, but I wonder if there is a better way using INFORMATION_SCHEMA.COLUMNS ?
CmdStr = $"...
0
votes
1
answer
55
views
MRU structure with fixed number of elements, automatically adapting to LINQ queries
I have a folder containing huge numbers of files in many subfolders, and I want to select the files with a name that matches any of a specified list of patterns (regular expressions). My regular ...
9
votes
5
answers
6k
views
How to Add JWT Token Support Globally in Scalar for a .NET 9 Application?
I'm working on enabling Scalar in my .NET 9 application and need to configure it to use JWT tokens globally, similar to how Swagger allows adding JWT token authentication globally. However, I couldn't ...
1
vote
3
answers
8k
views
SqlDataReader Reader.Read() shows Enumeration yielded no results
I am Trying to generate random Ids from a given table. I can see the random number generated in debug but when I reach to reader.Read() line it shows Enumeration yielded no results.
I couldn't quite ...
1
vote
1
answer
4k
views
Blazor - Drag and Drop uploads file
I'm facing an issue with uploading a file via the Drag'n Drop API.
Here the following blazor component:
<InputTextArea
@ondrop="HandleDrop"
@ondragenter="...
0
votes
1
answer
2k
views
WinUI 3 XAML Animations
In a WinUi 3 MVVM project I have a media (image and videos) Json list that plays one my one with a certain duration, I am trying to add a fade in and out whenever the image changes, I have tried ...
1
vote
0
answers
37
views
Required data annotations returning namespace rather than error message value?
I have an ASP.NET Core 8 MVC application, using the bog standard [Required] attribute on a class property. I expected to see the defined error message in my HTML, in the data-val-required attribute on ...
0
votes
0
answers
72
views
Async void function returns immediately when making POST request [duplicate]
I'm trying to send a POST request using Newtonsoft.Json and HttpClient in C# and I've been using Postman to test out the JSON.
As soon as I send the post, it immediately exits the CreateQuotePost ...
0
votes
0
answers
59
views
.NET is not recognized
In a .NET Core C# project, I get many errors like this:
Predefined type 'System.Object' is not defined or imported
Primary variables such as int and string are not recognized.
I have tried the ...
3
votes
2
answers
1k
views
Blob Fields in Crystal Reports using ASP.Net
I tried various methods given online to insert an image in Crystal Reports dynamically from database but it did not work for me. The Image is still not getting displayed. I have tried doing it by ...
-1
votes
0
answers
28
views
Casting from list of VirtualKey objects to RegisterHotKey
I'm using DevWinUI's shortcut control but I'm confused on how to get the key and modifiers from it and then casting it to the proper types for RegisterHotKey.
The shortcut control returns public new ...
0
votes
1
answer
11k
views
How to set path in config file
I have a test which runs a script. It gets the path from the app.config file:
<scriptsSectionGroup>
<scriptsCollection>
<scripts>
<add name="TestScript" path="C:...
Best practices
0
votes
1
replies
49
views
Filling the `entityIds` property in EF Core
I am currently developing a module for an ASP.NET Core Web API that uses EF Core to talk to MySQL. The problem is I have no idea how to make EF Core fill the entityId property.
Here is the example ...
3
votes
7
answers
15k
views
Read <body> tag of HTML file using C#
I need to get all the content inside the body tag of an HTML file using C#. Are there any good and effective ways of doing this?
0
votes
2
answers
64
views
C# project with a package reference to a nuget with an exe assembly
I know that in the early times of .NET Framework, you could build an assembly into EXE and then use that "EXE assembly" as a dependency of another .NET Framework assembly which, too, could ...
0
votes
1
answer
41
views
editorconfig rule to enforce that namespace is set in all C# files
I want to set a rule in .editorconfig so that all C# files where namespace is not explicitly set should render an error.
I've added these:
dotnet_diagnostic.IDE0130.severity = error # Namespace does ...
2
votes
3
answers
5k
views
Open HTML file in browser in WPF application
My applicattion is WPF:
I want to open the local file help.html of my project in the default browser.
I have created a button Help, in the event I want to open this .html.
I have some problems with ...
8
votes
11
answers
16k
views
How to tell if a URL is an intranet url?
Using C# how would one determine if a URL is an intranet URL? I would like some code to do something if a URL is an intranet one vs public.
-5
votes
0
answers
27
views
Issues using Machine Translation plugins for SDL Studio through API [closed]
I'm working on a translation workflow using SDL Studio solution through API calls. Works just fine, our tool can call upon Studio to create a translation project, fill it with the files to be ...
33
votes
9
answers
97k
views
Windows service stops automatically
I made a Window service and let it work automatically and under localsystem account, when the service starts it fires this message for me and then stops
The [service name] service on local computer ...
50
votes
14
answers
46k
views
NavigationError on NavigateTo
I'm trying out Blazor ServerSide and created a Component to Redirect To the Login Page when a user is not logged in.
@inject Microsoft.AspNetCore.Components.NavigationManager NavigationManager;
@...
5
votes
3
answers
2k
views
NotSupportedException: The member IssueDate of type System.DateOnly cannot be used as a parameter value
I have the following code which inserts data into the SQL server database. The database table DataEntries column IssueDate is of data type Date. There is a problem with the IssueDate = DateOnly....
0
votes
0
answers
48
views
VS Code doesn't Recognize Unity Classes
For two days now, I've been having a rather strange problem.
The MonoBehaviour class isn't recognized by VS Code, with the following error:
Error while loading [...]: Exception thrown: System....
12
votes
4
answers
11k
views
How to conditionally SetProperty with Entity Framework Core ExecuteUpdate?
When querying a database with EF Core, it's easy to conditionally add .Where clauses to a query before executing the query, e.g.:
[HttpGet]
public async Task<List<Entity>> GetEntitiesAsync(...