340,756 questions
Tooling
0
votes
0
replies
24
views
Easy mappings for GraphQL requests without using the GraphQL Client
I am trying to send requests to an API that uses GraphQL for its data filtering. The problem I am having that I need to build each request manually through a string interpolation which is easier said ...
0
votes
1
answer
36
views
How to fix ERR_INVALID_URL_SCHEME when initializing C# in WebAssembly in node.js?
While I was able to get my C# code running in the browser as WebAssembly, I get errors like this when trying to run any (vitest) unit tests that load the module that initializes .NET:
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯...
0
votes
1
answer
34
views
Localstack returning error when trying to provision a dotnet8 lambda
I'm trying to provision a lambda on a free localstack instance. As such, I cannot build the lambda as an image and push it into localstack's ECR because ECR is a paid resource. So I'm taking the ...
Best practices
3
votes
3
replies
87
views
C# CancellationToken across chain of api calls
I have the following application architecture:
FrontEnd → ApiServer 1 → ApiServer 2 → Database
So, the frontend calls a web server, which calls multiple API which make query on database.
What is the ...
0
votes
0
answers
47
views
Sap .NET connector (SAP Nco 3.1.6) for .NET 8 throws an error "could not find sapnco_utils.dll' file
I'm trying to use the Sap connector for .NET 8 (v3.1.6) and i have run into an error saying that the "sapnco_utils.dll" module is not found. I have the dll file and I have added the assembly ...
0
votes
1
answer
30
views
Stack settings are blank in configuration tab
I am deploying an azure webapp with the following settings:
resource functionAppName_web 'Microsoft.Web/sites/config@2021-03-01' = {
parent: functionAppName
name: 'web'
properties: {
...
0
votes
1
answer
104
views
Changing the version of an assembly reference is not allowed during debugging
I get this error:
Failed to emit module 'xyz': Changing the version of an assembly reference is not allowed during debugging: 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=...
2
votes
1
answer
83
views
System cache constantly grows when stress testing backend app
I've been stress testing my .NET application that uses PostgreSQL to find memory leaks. The app is very stable memory-wise — memory usage only depends on the number of concurrent connections.
However, ...
2
votes
1
answer
87
views
Replace strings in files when using a .NET item template
I am creating my first template for a .NET solution. For the most part it works, but I have a string "MyService" at some places in the Program.cs that I would like to replace with "...
4
votes
1
answer
92
views
Deserialization of XML with multiple namespaces
I'm attempting to deserialize an XML response from an API. The data is as follows (I have only included a small chunk for the sake of a small post):
<ns1:alerts xmlns:ns1="http://gov.fema....
0
votes
1
answer
208
views
What’s the most efficient way to map large entity models to DTOs in ASP.NET Core without using AutoMapper? [closed]
I'm working on a high-performance ASP.NET Core Web API where each request can return hundreds of entity records. Each entity includes multiple navigation properties and nested objects.
Currently, I’m ...
4419
votes
35
answers
1.1m
views
How can I enumerate an enum?
How can you enumerate an enum in C#?
E.g., the following code does not compile:
public enum Suit
{
Spades,
Hearts,
Clubs,
Diamonds
}
public void EnumerateAllSuitsDemoMethod()
{
...
2682
votes
61
answers
1.1m
views
Deep cloning objects
I want to do something like:
MyObject myObj = GetMyObj(); // Create and fill a new object
MyObject newObj = myObj.Clone();
And then make changes to the new object that are not reflected in the ...
1
vote
1
answer
32
views
How to set up appsettings.json for feature flags using Microsoft Feature Management
Microsoft's feature management documentation implies that the correct format for config for feature management is the following:
{
"feature_management": {
"feature_flags&...
-1
votes
0
answers
87
views
How to detect the current user session in Intune deployment?
I have a C# installer app that needs to identify which user session to target. The application fails to identify the correct user when deployed via Microsoft Intune.
For example, when deployed via ...
0
votes
0
answers
48
views
How to use JSExport in two projects in the same web+C# app
I started with a working app with static exported C# methods like
[SupportedOSPlatform("browser")] // suppress CA1416 "only supported on: 'browser'"
public static partial class ...
0
votes
2
answers
108
views
Is it possible to use generic argument of a type for its attribute parameter (JsonConverter)?
Use case: I want to write a JsonConverter for a generic type like this, but I cannot apply it to the type itself:
public class EditingModelConverter<T> : JsonConverter<EditingModel<T>&...
1008
votes
114
answers
1.3m
views
Metadata file '.dll' could not be found
I am working on a WPF, C# 3.0 project, and I get this error:
Error 1 Metadata file
'WORK=- \Tools\VersionManagementSystem\BusinessLogicLayer\bin\Debug
\BusinessLogicLayer.dll' could not be found C:\-=...
0
votes
0
answers
45
views
Grpc bidirectional stream not throwing exception when not implemented
With a new version of grpc a new service was introduced with a new bidirectional stream. The problem is, that when the server runs with an old grpc, the stream does not (reliably) throw an exception ...
2191
votes
49
answers
1.4m
views
How do I create an Excel (.XLS and .XLSX) file in C# without installing Microsoft Office?
How can I create an Excel spreadsheet with C# without requiring Excel to be installed on the machine that's running the code?
1
vote
0
answers
258
views
iOS 26 and .NET MAUI 9 - Flyout Hamburger Icon and Back button color being overwritten by iOS appearance
I have a .NET MAUI Shell application with a Flyout menu targeting .NET 9. The Action Bar in both Light and Dark mode is set to be black. I want the hamburger menu icon and the back button to be white ...
0
votes
1
answer
69
views
Blazor auto render mode prerender flicker problem even though pages use persistence
There are two pages in my app:
Page1.razor (home) and Page2.razor. There is no problem rendering first page. But when I navigate to second page, there is flicker problem. I put 1000 ms sleep to better ...
2
votes
2
answers
88
views
How to disable binary log generation using Microsoft Testing Platform and xUnit v3?
I have the following project structure (the full repo can be found at https://github.com/asarkar/functional-csharp-buonanno) that uses Microsoft Testing Platform + xUnit v3 for testing.
root
├── src
│ ...
2631
votes
29
answers
909k
views
Catch multiple exceptions at once?
It is discouraged to catch System.Exception errors. Instead, only the "known" exceptions should be caught.
This sometimes leads to unnecessary repetitive code, for example:
try
{
WebId = ...
0
votes
1
answer
169
views
.NET 8.0 Avalonia browser application stuck on splash screen
I am developing an Avalonia application and I decided to try the multi-platform.
The project I started is using .NET 8.0, infact I installed the .NET 8.0.121 SDK. When I start the application on the ...