340,756 questions
0
votes
1
answer
114
views
Blazor virtualization for items with different sizes
Blazor supports virtualization but items need to have same height. For most cases it's okay, but for example for chats where amount of messages can be high and messages have different heights due to ...
1
vote
0
answers
61
views
Unable to publish .NET MAUI iOS application – "No iOS signing identities match the specified provisioning profile"
I am working on a .NET MAUI project targeting .NET 8 for both Android and iOS. The app builds and runs fine in debug mode on both platforms, and I can test it locally in the simulators without issues.
...
1583
votes
19
answers
630k
views
Why is Dictionary preferred over Hashtable in C#?
In most programming languages, dictionaries are preferred over hashtables.
What are the reasons behind that?
2
votes
1
answer
204
views
Running each target on all compatible frameworks using `dotnet test`
I have a library with TargetFrameworks set to netstandard2.0;net462;net6.0;net8.0.
I want to run tests:
netstandard2.0 version on net462, net481, net6.0, net7.0, net8.0, net9.0
net462 version on ...
1
vote
3
answers
136
views
Right align Custom Caption Button - Syncfusion Dockingmanager
Syncfusion Dockingmanager, WPF C# App, all packages at latest version
After successful adding a custom caption button to a Dockingmanager window, I'm not able to right align (or right place) it, just ...
872
votes
24
answers
872k
views
How to read embedded resource text file
How do I read an embedded resource (text file) using StreamReader and return it as a string? My current script uses a Windows form and textbox that allows the user to find and replace text in a text ...
1
vote
2
answers
161
views
How to correctly add Arabic text to an AcroForm field in iText 7/9 (.NET) so it stays correct after flattening?
I’m working with iText 9.3.0 for .NET and need to fill a PDF form field (PdfTextFormField) with Arabic text and then flatten it so the text becomes permanent.
However, when I set Arabic text directly, ...
1080
votes
23
answers
1.0m
views
.NET String.Format() to add commas in thousands place for a number
I want to add a comma in the thousands place for a number.
Would String.Format() be the correct path to take? What format would I use?
1
vote
0
answers
84
views
PowerShell hosting in C#: implicit remoting
I want to use the PowerShell 7 cmdlet Get-ClusterResource in C# under Windows 11, like this:
using System.Collections.ObjectModel;
using System.Management.Automation;
namespace PSHosting;
class ...
1
vote
2
answers
96
views
Throw build time-error if a class library was referenced, but custom targets was not imported
I have a class library project (C#) that contains a custom build logic in the custom .target file. To properly consume this class library, it is mandatory for a consuming project to include not only ...
0
votes
1
answer
142
views
Aspire Dockerized Project Fails to Start on Windows — “Address Already in Use” for RabbitMQ/MongoDB, Works on Teammates’ Machines
I have an Aspire project that runs RabbitMQ, MongoDB, and PostgreSQL in Docker containers. My AppHost project defines them like this:
var rabbitMQ = builder.AddRabbitMQ("rabbitmq")
....
1
vote
1
answer
94
views
Why does await Task.WhenAll() with LINQ Select lose exception stack trace?
I’m using Task.WhenAll with LINQ to run multiple async operations. However, when an exception is thrown inside one of the tasks, the stack trace seems incomplete compared to when I await each task ...
696
votes
41
answers
1.5m
views
How do I make a textbox that only accepts numbers?
I have a windows forms app with a textbox control that I want to only accept integer values. In the past I've done this kind of validation by overloading the KeyPress event and just removing ...
0
votes
0
answers
44
views
Problem with populating Fast Report via .NET code
I am trying to populate my fast report with dummy data using .NET code
DataTable dt = new DataTable();
dt.Columns.Add("name", typeof(string));
dt.Columns.Add("days", typeof(string))...
1
vote
0
answers
70
views
Server Side pages in Blazor WASM project
I am trying to integrate some server side pages in a Blazor Web App using Webassembly. I have a few pages in the client project, but I want some pages to run on the server. As such, I have added a ...
1178
votes
11
answers
496k
views
DateTime vs DateTimeOffset
What is the difference between a DateTime and a DateTimeOffset and when should one be used?
Currently, we have a standard way of dealing with .NET DateTimes in a TimeZone-aware way: Whenever we ...
-3
votes
3
answers
180
views
Async or sync functions in unit tests?
Consider this unit test of an API client with an async function Index. Index should throw an exception when an http error occurs and thats what I want to test.
public async Task TestServiceError()
{
...
1
vote
2
answers
119
views
ASP.NET Core dependency inject (Generic) error
I want to create a repository base class, every service should inherit from this BaseService.
This is my code:
public class BaseService<TEntity, TAddDto, TUpdateDto, TEntityDto> : IBaseService&...
3
votes
1
answer
161
views
C# Native AoT - How to get pointer to Managed class to pass as parameter to Com Object
I have implemented INetworkListManagerEvents interface to get network connectivity state changes as a C# class.
In my project, the INetworkListManagerEvents is code generated via CsWin32 source ...
0
votes
0
answers
61
views
Force explicit BLE disconnect with Windows.Devices.Bluetooth BluetoothLEDevice
I am using the C# Windows.Devices.Bluetooth APIs to communicate with a device via BLE.
The BluetoothLEDevice class does not expose connect or disconnect methods but at least the connect can be forced ...
4
votes
2
answers
157
views
ToolTip.Popup event not firing with ToolTip.Show() in .NET Framework
I have an old WinForms application with a normal TreeView, where I need to show customized tooltips for individual nodes.
I am using a ToolTip component (OwnerDraw=true and IsBalloon=false), and I ...
0
votes
0
answers
78
views
Dapr / Aspire PubSub not loading component yaml
I am attempting to setup a project with Aspire and DAPR.
I want to register a sidecar in my API and Frontend application that will use pubsub. The pubsub should come from a DAPR yaml component file.
I ...
1
vote
2
answers
104
views
IHttpActivityFeature or System.Diagnostics.Activity?
There are 2 ways I am aware of to get Activity Id inside my ASP.NET request:
var id1 = System.Diagnostics.Activity.Current?.Id;
var id2 = _httpContextAccessor.HttpContext?.Features.Get<...
5
votes
1
answer
100
views
Code signing external logging libraries (Nlog, Serilog) [closed]
The logging library .dlls, like Serilog.dll or Nlog.dll are not digitally signed by any code signing certificate from CA. I have been trying to find an info if in a case of commercial application, ...
0
votes
1
answer
145
views
Cursor AI Agent terminal never stops (spinner keeps running) after dotnet build finishes
I’m running a .NET project from the Cursor AI Agent terminal. The build finishes (I see the final summary line), but the Agent’s terminal keeps “running” forever (spinner never stops). I have to press ...