340,750 questions
0
votes
0
answers
11
views
Use a build Target to create resource files that need to be embedded during the build
I have a project where I need to dynamically create .resx files based on other input files that are coming from somewhere else. These created .resx files then need to be compiled and embedded in the ...
1
vote
1
answer
37
views
IHost does not release log file after Dispose()
I'm trying to read a log file that was written from a custom ILoggerProvider in a dotnet application:
HostApplicationBuilder builder = Host.CreateApplicationBuilder();
builder.Logging.ClearProviders();...
1
vote
2
answers
86
views
How to call Postgres function from .NET?
I tried this code:
CREATE OR REPLACE FUNCTION public.t4(in iid int, OUT n1 text, OUT n2 text)
LANGUAGE plpgsql
AS $function$
BEGIN
SELECT DISTINCT n1=l.name, n2=l.comment from ...
Best practices
0
votes
4
replies
92
views
Disposing FileStream in .NET
I need to process a list of FileStream objects with the DoSomethingWithFileStreams method like below. If I write code like this, I am concerned that the list of FileStream gets disposed before they ...
-2
votes
1
answer
61
views
Should I reorder triangle vertices depending on their position to ensure correct winding (CW/CCW)?
I draw triangles in OpenGL using DrawArrays():
public void DrawTriangle(
Vector2 a,
Vector2 b,
Vector2 c,
ShapeOptions shapeOptions = null)
{
shapeOptions ??= PresentationConsts.Shape....
0
votes
1
answer
48
views
Could not load file or assembly 'MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified
I have a main project of type console, and it references other library-type projects in the application. When I build the solution, it compiles normally, but when I run it in debug mode, it tries to ...
0
votes
1
answer
50
views
How can I get Liquid Data Mapper to target .NET 8 and not .NET Framework 4.6.2?
When I generate a data mapper library using Liquid Data Mapper, it always binds to .NET Framework 4.6.2, but I need it to target .NET 8.
How can I change this functionality?
My source is a CSV file ...
-1
votes
1
answer
56
views
Publish Failed, but able to build successfully, and run
My project is able to build and run, but when I want to publish the project, I get this :
Warning As Error: Detected package downgrade: System.Net.NameResolution from 4.3.0 to 4.0.0. Reference the ...
0
votes
0
answers
44
views
.NET Framework SDK project: Launch arguments duplicated for x64 platform
I'm working on a C# .NET Framework 4.8 SDK-style project (WPF, Sdk=Microsoft.NET.Sdk).
I want to pass command-line arguments to my project when running from Visual Studio. I created a launchSettings....
1
vote
0
answers
39
views
Angular Aria Autocomplete Feature - Compilation Error
I am working with a .NET + Angular WebApp Project
I added Angular Aria to the Angular project hoping to use their Autocomplete feature for a Select Box.
I copied the code directly from the first ...
1
vote
1
answer
21
views
How to create an APK file from a Xamarin project using the command line?
Can you tell me what I need to do to get the APK through the console?
How do I check that all the needed tools are installed?
And which command or set of commands will create the APK file?
I can ...
1
vote
0
answers
44
views
How can I define a structure type in an OPC-UA server?
I am using OPCFoundation.NetStandard.Opc.Ua.Server (version 1.5.377.22) and would like to:
Create a structure data type on the server.
Create a variable node of that data type on the server.
Set ...
0
votes
1
answer
34
views
Weird blurring / gradient mask effect in safe area on dotnet MAUI maccatalyst
I'm building a dotnet maui application. One of the targets that I am using is Mac OS X maccatalyst. My app consists of a hybrid web control that goes into the safe area with negative top margin so ...
0
votes
0
answers
58
views
My MCP Server is not discovering my custom tools
I have a stdio mcp server running locally. The mcp server builds and runs. I have created 3 basic mcp tools that I will use for context when I prompt in Copilot however my tools are just not ...
1
vote
0
answers
28
views
Socket with SignalR and kubernetes
I encountered a problem when deploying a socket application using signalr. I connect with the longpolling method and it still works, but the websocket gives an error: Error: Failed to start the ...
1
vote
1
answer
98
views
'SQLite Error 19: 'FOREIGN KEY constraint failed'.' while try to insert data
I am trying to run my database code, but I keep getting this error and I've done whatever I can think of to fix it, whether it is random posts, or chatgpt, but I can't seem to figure it out. The ...
0
votes
0
answers
32
views
EKS SignalR Hub - ALB Connection Handling Issue
SignalR hub running as an EKS pod handles 700 VUs via ALB but fails at 720+, yet successfully handles 1000 VUs via kubectl port-forward with 85% free CPU and 43% free memory. This confirms the ...
1
vote
0
answers
55
views
Dotnet Restore cannot find .NET 9 packages (NU1102) even though they exist in internal Artifactory NuGet
We use an internal Artifactory NuGet feed inside our organization.
Here is my NuGet.Config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<...
-3
votes
0
answers
65
views
Microsoft Learn sample C# code issue on .NET 10.0 [duplicate]
I have just started learning C# from its official tutorial in Microsoft Learn. In the record type section I saw this code:
public record Point(int X, int Y);
public static void Main()
{
Point pt = ...
0
votes
1
answer
91
views
AWS S3 .NET SDK download fails for .mp4 and .mp3 files with IOException: “An existing connection was forcibly closed by the remote host”
I’m using the AWS S3 .NET SDK (Amazon.S3 + TransferUtility) to download files from an S3 bucket.
Most file types download correctly (.txt, .zip, .webm, .ogv), but .mp4 and .mp3 always fail with this ...
0
votes
0
answers
61
views
Why does DevExpress Report only display one row despite multi-row data source?
I am working with DevExpress v24.1 in a C# Windows Forms application. I am facing an issue where my DevExpress report only displays a single row of data, even though the assigned data source contains ...
0
votes
0
answers
44
views
Is it possible to add a column to a datatable read from a file?
I have a DataTable read from a csv file:
ID,ItemCode,ItemDescription
1,Test0,test item
2,Test2,second test item
When I try to create an additional column as in https://learn.microsoft.com/en-us/...
0
votes
1
answer
75
views
Why is my appsettings.json being ignored?
I have an ASP.NET Core 8.0 web application. In the appsettings.json I have a connection string defined. One pointing to a local database and one pointing to another database.
"ConnectionStrings&...
0
votes
1
answer
49
views
WPF returns UnsetValue on RelativeSource to Ancestor
I was able to create a neat context menu that controls visibility of columns and wanted to show values of hidden ones in a tooltip, but I'm unable to, because somehow the very same binding is ...
0
votes
0
answers
22
views
CefSharp instancing a new application when Cef.Initialize
i'm having trouble initializing Cef since i updated its version, we are using the version 89.0.170 and we upgraded to 140.1.140. the scenario is a follow:
internal static class Program
{
...
Tooling
0
votes
0
replies
37
views
Using OSDP.Net library how to poll PD (card reader) for presence of card
In the OSDP.Net library there is ControlPanel class representing control panel (ACU), which communicates with one or several PD (card readers). Class has RawCardDataReplyReceived event, which is ...
0
votes
1
answer
88
views
Is it possible to implicitly convert 'method group' to Delegate?
I tried experimenting with the new C#14 extension syntax. As an example, I wanted to implement a simulation of function currying using the << operator.
public static class Curry
{
extension&...
2
votes
1
answer
106
views
Entity Framework/Linq Get Last Record From List With Condition
I have a list of records, by multiple UserID's.
TableID UserID Status
------------------------
1 3 3
2 4 3
3 3 4
4 4 3
5 5 4
6 ...
0
votes
0
answers
51
views
How to fix IIS Express profile error in Visual Studio 2022? [closed]
I am trying to run my .NET project in Visual Studio, but whenever I start the application—whether using Debug or Run—I get an error popup saying:
This project doesn't know how to run the profile with ...
Advice
0
votes
0
replies
38
views
How to implement session timeout in .NET Framework 4.7.2 application
We have several applications built in .NET Framework 4.7.2 that uses .NET Identity for authorisation and authentication. I am trying to implement a session timeout, in line with OWASP recommendations.
...
0
votes
1
answer
58
views
Dapper query with parameter not holding temp table in subsequent query [duplicate]
I have C# code that executes a Dapper Query, creates a temporary table, and uses a parameter to pass a value. In a subsequent query temp table is not available and will throw an error
Invalid object ...
0
votes
1
answer
113
views
Get System.Timers.Timer to fire on a WPF Window's thread using the Timer's SynchronizingObject
I tried setting the SynchronizingObject like this:
timer.SynchronizingObject = this;//The Window
but VS told me I need an explicit cast. So I did that and the error went away.
timer....
-3
votes
0
answers
74
views
HttpClient and headers
I have a legacy .NET 4.8 framework project.
I have tried to get these headers:
Accept-Encoding
CacheControl
sent to my endpoint.
But looking with Fiddler, they are not sent, even if I explicitly set ...
1
vote
1
answer
145
views
How do I fill the rectangle with a color
private SolidBrush b;
private Graphics g; //Encapsulates a GDI+ drawing surface
Pen p = new Pen(Brushes.DeepSkyBlue); //Pens are used to draw objects
...
2
votes
1
answer
69
views
How do I define an MSBuild variable for the VSCode C# completion server?
I'm building a mod for Unity based game RimWorld. I have the following assembly references in my .csproj file, using a variable so other people can build the project regardless of where RimWorld is ...
0
votes
0
answers
32
views
WiX MSI installer not stopping and removing .NET 8 Windows service
Here is my .wxs file contents:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Package Name="...
Advice
1
vote
3
replies
74
views
Dynamic Forms in ADO.NET
I am a newbie in .NET - can someone tell me about dynamic forms? I have done master detail and simple crud - should I go for dynamic form r practice more in master details. I want to know about ...
1
vote
1
answer
58
views
Windows.System.Profile.HardwareIdentification.GetPackageSpecificToken throws exception
I'm trying to get a hardware id with a .net console app (target framewotk is net8.0-windows10.0.17763.0).
The code is rather trivial, just
var token = Windows.System.Profile.HardwareIdentification....
0
votes
2
answers
92
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
0
answers
56
views
Does anybody else have issues with sideloading after updating to Visual Studio 2026?
I recently updated my Visual Studio to the newest version (2026). Since I updated, my Android devices no longer appear in the list of devices. But even worse, since the update they don't appear in my ...
1
vote
1
answer
56
views
Issue with Template.Json not excluding files
I have built a template project with a Template.json and this will generate the template fine ( no errors at all )
ive also managed to add some choices to the symbols that will add or hide code ...
0
votes
1
answer
62
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 ...
0
votes
1
answer
35
views
"No operations defined in spec!" when using MMLib.SwaggerForOcelot to build combined swagger for Ocelot
This is my ocelot configuration...
{
"Routes": [
{
"UpstreamPathTemplate": "/api/test/{url}",
"DownstreamPathTemplate": "/api/{url}",...
1
vote
1
answer
81
views
Problem with Roslyn configuration on neovim
I've been trying to setup roslyn.nvim with rzls.nvim on my neovim for a while to work with .NET, C# and Blazor. But I've been facing some frustrating problems, I'm using WSL Ubuntu 24.04, a neovim ...
0
votes
0
answers
124
views
MAUI .NET 9 Android: "Application APK file path is not found" in Rider for both Debug and Run, simulator and physical device
I'm trying to debug and run a .NET MAUI Android app targeting .NET 9 in JetBrains Rider (2025.1.3).
SDKs installed:
9.0.308 [C:\Program Files\dotnet\sdk]
10.0.100 [C:\Program Files\dotnet\sdk]
...
Best practices
1
vote
5
replies
91
views
Handling mutable models in MVVM
In an MVVM architecture, models should be kept free of UI-related logic. They represent pure data that is retrieved from memory via a service. I see a challenge when the user interface needs to ...
0
votes
0
answers
24
views
Revit 2024 API: Family cannot be loaded from fixed file path (Truss Hole Add-in)
I'm building a Revit 2024 add-in that places a circular void hole where the user clicks in the model.
The hole family has a “Diameter” parameter and cuts only structural framing members around the ...
-1
votes
0
answers
77
views
VS Code fails to run .NET, even if I installed it
When I open a workspace in VS Code, I get this error message notification on the bottom right corner :
Failed to run .NET runtime. You may be missing key Linux libraries. Install them now?
Source: ....
-7
votes
0
answers
105
views
Whenever I try to compile my MAUI project I get CS0246 Error
I'm trying to build a three piece Streaming Project in which I need to build an API that is already working, a Java App for Android that I haven't even started and this .NET MAUI using C# that is ...
Best practices
0
votes
3
replies
77
views
Can a Composite Component class inherit from another abstract base class without breaking the Composite pattern?
I’m studying and implementing the Composite design pattern in C# for a university project.
In most textbook examples (GoF, Refactoring.Guru, etc.) the class hierarchy looks like this:
Component
├── ...