Skip to main content
Filter by
Sorted by
Tagged with
2374 votes
41 answers
1.2m views

How do I convert a string to a byte[] in .NET (C#) without manually specifying a specific encoding? I'm going to encrypt the string. I can encrypt it without converting, but I'd still like to know ...
Agnel Kurian's user avatar
  • 59.9k
1 vote
1 answer
84 views

I'm upgrading from protobuf-net 2.2.1.0 to 3.2.26, and I've noticed that callback methods decorated with [ProtoBeforeSerialization] and [ProtoAfterDeserialization] are no longer invoked during ...
Sudheer Kumar's user avatar
1 vote
0 answers
134 views

I am trying to pass a javascript array of objects to a .NET controller action List<> parameter. Below is my C# public bool ImportACE([FromBody] List<Element> elements) { foreach(...
NerdyDriod's user avatar
3 votes
1 answer
167 views

(I am aware using windows forms for this kind of project is stupid and inefficient but it is a requirement for the college course I'm doing so I'm stuck using this) in windows forms you can draw an ...
Halbear gameZ's user avatar
1 vote
1 answer
92 views

I'm pretty new to this (4 months into my first dev job) and I'm stuck on something. The company asked me to write a C# program that uploads files from my computer to SharePoint Online. I googled ...
Mattia's user avatar
  • 11
Best practices
0 votes
0 replies
40 views

We are building and deploying a few system using the AWS CDK Pipeline, mostly with dotnet Most cases we are building the deployed apps using dockerfile assets referenced in the CDK Should we run the ...
Erik Karlsson's user avatar
1866 votes
26 answers
2.5m views

I have some code and when it executes, it throws a NullReferenceException, saying: Object reference not set to an instance of an object. What does this mean, and what can I do to fix this error?
1 vote
1 answer
50 views

When you add an appsettings.json file to a project, the following is inserted in its .csproj file: <ItemGroup> <None Update="appsettings.json"> <CopyToOutputDirectory>...
Ian Kemp - SO dead by AI greed's user avatar
1 vote
0 answers
68 views

I am creating a lib to listen to server notifications (more than 100,000 requests per hour), when using WebSocketSharp it is receiving all 100,000 notifications but there is memory leak (server goes ...
MSD86911's user avatar
1 vote
1 answer
115 views

I have the following project structure (the full repo can be found at https://github.com/asarkar/functional-csharp-buonanno) root ├── Directory.Packages.props ├── src │ └── Proj1 │ └── Proj1....
Abhijit Sarkar's user avatar
1341 votes
39 answers
1.3m views

How can I generate a random 8 character alphanumeric string in C#?
KingNestor's user avatar
  • 68.4k
2 votes
1 answer
156 views

I am currently trying to utilize the Spinnaker SDK in a C# .NET8.0 application. My goal is to make a cross-platform application that runs on both Windows-x64 and NVIDIA Jetson Orin (Linux ARM64) I ...
bone's user avatar
  • 11
1 vote
1 answer
69 views

Use case: to dequeue plain string messages and print them line by line on to tractor feed paper without a form feed happening after each message is printed. Current solution (in code below) prints one ...
Josh Pudsey's user avatar
0 votes
0 answers
36 views

I have been successfully reading the logged in OIDC authentication scheme from IAuthenticateResultFeature when using OIDC. I need to know this scheme to perform sign out. This is for a .NET 8 ASP....
Eric's user avatar
  • 2,420
2 votes
2 answers
279 views

I want to use PowerShell in C#. Example: using System.Management.Automation; namespace PSTest; class Program { static void Main() { using (var powerShell = PowerShell.Create()) ...
Andreas's user avatar
  • 91
0 votes
1 answer
29 views

I'm running .NET 9.0.306 on macOS ARM64 and encountering an issue when running unit tests that call an external HTTPS API via HttpClient. Note - Cookies disabled because problem first appeared as a ...
Luke Puplett's user avatar
  • 45.9k
1 vote
2 answers
237 views

I have a code snippet that uses let with a where clause. private List<string> Example2() { var query1 = from c in _context.Customers let custPurchases = _context.Purchases....
Romanov Nikita's user avatar
0 votes
0 answers
228 views

I am on an air gapped network trying to run a C++ project that uses solution files from Visual Studio, because that is what the rest of my team uses. I have: C# Dev Kit 1.61.22 C# 2.93.21 .NET ...
Alexander Berryhill's user avatar
336 votes
59 answers
849k views

While trying to connect to Nuget, I'm getting the error below, and then I am unable to connect: [nuget.org] Unable to load the service index for source https://api.nuget.org/v3/index.json. An error ...
DarthVader's user avatar
  • 55.6k
1 vote
0 answers
120 views

I have following context menu defined as a part of the DataTemplate in xaml: <DataTemplate DataType="{x:Type viewModel:OverviewAnnotationItemViewModel}"> <views:...
Djomla's user avatar
  • 13
1693 votes
25 answers
308k views

In .NET, the GetHashCode method is used in a lot of places throughout the .NET base class libraries. Implementing it properly is especially important to find items quickly in a collection or when ...
bitbonk's user avatar
  • 49.9k
1 vote
0 answers
207 views

A BinaryInteger<T> is an integer of some bit-length. I'd like to use it to index an array. Casting to an int isn't possible - I have to use int.CreateTruncating(i) (or similar) at run-time to ...
n8wrl's user avatar
  • 19.9k
1915 votes
20 answers
457k views

I know from reading Microsoft documentation that the "primary" use of the IDisposable interface is to clean up unmanaged resources. To me, "unmanaged" means things like database ...
cwick's user avatar
  • 26.7k
628 votes
72 answers
379k views

When debugging in Visual Studio, sometimes I add a breakpoint but it's hollow and VS says "The breakpoint will not currently be hit. The source code is different from the original version." Obviously ...
0 votes
0 answers
58 views

We are a little confused about pre-compiling a template. for example: Is it possible to store the template variable in say a database and then just retrieve it and call string source = @"<div ...
user2981411's user avatar