587 questions
1
vote
2
answers
86
views
Avoid CS8618 warning when local member is instantiated via different method called within constructor [duplicate]
This question relates to the nullable / non-nullable reference types that were added in C# 8.0
If I have the Nullable property within my project set to 'Enable', and I have a class where a field is ...
0
votes
0
answers
65
views
How to call .NET Core 8.0.20 C# code from Excel VBA through a native C++ DLL host?
I am trying to call .NET Core 8 (C#) code from C++ dll in Excel VBA.
The architecture I’m targeting is:
Excel (VBA) → C++ native DLL → .NET Core 8 C# DLL
The idea is that the VBA code calls the native ...
0
votes
0
answers
58
views
C# Restful API on Azure using Microsoft Information Protection SDK File API for C++/.NET version 1.17.158 - VERY SLOW
We need to use On-behalf-of flow using delegatedUser permissions to accept a file from a Angular client, determine if it's protected and then decrypt it and use decrypted bytes for various reasons.
we ...
0
votes
0
answers
9
views
How to convert a sender object to a ListItens object?
In my code convertion of VB.NET to C#, is error in convertion...
"Cannot implicitly convert type 'object' to 'demoComp.ListControlItem'. An explicit conversion exists (are you missing a cast?)&...
2
votes
1
answer
104
views
Singleton Dependencies in Background Task Channel / Hosted Background Service
I am working on creating some ASP.NET Core 8.0 Web API endpoints (in C#). There will be over 100 endpoints across 40-50 repositories that are all a part of the same platform ecosystem; it is not an ...
4
votes
0
answers
58
views
Why does pattern matching match Int16[] to UInt16[] in c#? [duplicate]
Why is it that if I switch on an Int16[] in C#, it will match with UInt16[], even when an Int16[] is present later in the switch statement?
Example Code:
namespace SwitchError;
internal class Program
...
0
votes
0
answers
287
views
ASP.NET Core MVC: wwwroot folder not recognized or not working
When I create a new ASP.NET Core MVC project, the wwwroot folder initially appears correctly, like this:when the project is created
However, when I close Visual Studio and reopen the project, the ...
0
votes
1
answer
37
views
Asynchronous File Validation Method Not Responding in Docker Environment
I'm working on an ASP.NET Core application running inside a Docker container. I have an API endpoint that processes a file asynchronously. The method picks a pending file, triggers an async validation ...
3
votes
0
answers
172
views
Blazor Server app stops working after installing Microsoft.AspNetCore.SignalR.Client
I generate a brand new blazor server project in ubuntu with "dotnet new blazor -o MyBlazorAppServer" command and it works perfectly fine when I launch it, but as soon as I install Microsoft....
-1
votes
1
answer
222
views
In C#, why is readonly only applicable to properties in structs? [duplicate]
public class MyClass
{
public readonly List<int> Value { get; } = []; // Error: Property cannot be 'readonly'
}
public record MyRecord
{
public readonly string Name { get; init; } // ...
1
vote
1
answer
319
views
Multiple Language Selection in Blazor United Project
To translate my application into multiple languages in a Blazor United Project and .NET 8, we need to use localization and resource files. This involves manually writing each sentence in key-value ...
1
vote
1
answer
84
views
Can't get @rendermode InteractiveAuto to execute code in sample app
In my blazor app, I'm trying to get @rendermode InteractiveAuto to work, so I created a simple sample project by creating a new project and including the sample pages.
I now have button on my home ...
0
votes
1
answer
486
views
Is is possible to have multiple lines in a switch statement of C# 8?
In C# 8 we have the return switch statement, which looks like this:
return a switch
{
1 => "op1",
2 => "op2",
3 => "op3",
_ => "default&...
0
votes
1
answer
235
views
Dictionary<Enum,decimal> for System.Text.Json deserialization error
I am unable to deserialize a Dictionary<Enum,decimal> from a JSON string when the enum key is in kebab-case-lower format. I tried defining JsonStringEnumConverter(JsonNamingPolicy.KebabCaseLower)...
1
vote
1
answer
761
views
How to institute logging from Poly ResiliencePipeline for success after failure
In C# I'm using Polly Version=8.4.1 and a reusable retry ResiliencePipeline via ResiliencePipelineBuilder.
return new ResiliencePipelineBuilder()
.AddRetry(new RetryStrategyOptions
...