Questions tagged [c#]
C# (pronounced "see sharp") is a high-level, statically typed, multi-paradigm programming language developed by Microsoft. C# code usually targets Microsoft's .NET ecosystem, which include .NET, .NET Framework, .NET MAUI, and Xamarin among others. Use this tag for questions about code written in C# or about C#'s formal specification.
1,620,488
questions
0
votes
0
answers
6
views
How to securely store and retrieve sensitive data in a .NET Standard 2.0 cross-platform (Windows+Linux) library
I have .NET Framework 4.7.2 library to store and retrieve sensitive data (like tokens) with help of CredentialManagement package on Windows. Now I need to make this library work both on Windows and ...
0
votes
0
answers
12
views
Is there a generic way to use SetReturnsDefault in Moq
I have a data access interface looking roughly like this:
public interface IDataRepository
{
DatabaseResult<Customer> GetAllCustomers();
DatabaseResult<Report> GetAllReports();
...
0
votes
1
answer
33
views
Problem installing .NET SDK in Visual Studio Code
I'm trying to use C# in VS Code which requires me to install the .NET SDK.
I'm following the steps provided by VS Code to install it, but it doesn't work, even after reinstalling it does not work.
...
-1
votes
1
answer
14
views
How to change DataGrid Cell background color in WinUi 3
How to change DataGrid cell background color in WinUi 3 based on binding value?
0
votes
1
answer
46
views
Getting "System.IO.FileNotFoundException: Could not load file or assembly 'Azure.Core, Version=1.38.0.0" in Azure Function App
Currently, I am running a .NET 8 Azure Function app in Azure. It's a dotnet-isolated function running on a Linux App Service plan.
I am getting this error when trying to run the HTTP trigger function:
...
-1
votes
2
answers
48
views
.NET 8 Rate Limiting via Policy
I am trying to run the .NET 8 Rate Limiting Middleware, with a global rate limit, as well as a specific policy for certain endpoints. The global policy is working as expected, but I cannot get the ...
0
votes
0
answers
12
views
Ghostscript Log Creation
I have an application where I am using ghostscript to convert image to pdf. I am using dll of ghostscript and using it in a .Net web api. And ghostscript software is also installed in the server, ...
2
votes
2
answers
4k
views
How to write data to USB HID device in Android with only a single input endpoint
I have a USB HID device that I would like to communicate with. I am successfully doing so on Windows using the HidSharp library (link: https://github.com/treehopper-electronics/HIDSharp). My Windows ...
1
vote
1
answer
16
views
Why do I have to specify the runtime identifier in the csproj for a publish?
I am doing the following to build my application:
dotnet build MyApp.sln -c Release
dotnet test MyApp.sln --no-build -c Release
dotnet publish MyApp.csproj --no-build -c Release -r win-x64
The aim ...
1
vote
3
answers
76
views
Fast integer sqrt using Math.Sqrt
I'm trying to calculate the square root of integer values. It doesn't need to be very accurate, but it should be fast and deterministic across platforms. I'm using this for a RTS game with lockstep ...
0
votes
0
answers
14
views
Overflow or underflow in the arithmetic operation error in ASP.NET Web API OData application
I have written an ASP.NET Web API OData application in which I am returning a single object which is working fine. Now my requirement is to return multiple entities from the GET request.
While trying ...
-2
votes
0
answers
10
views
Convert a html data or string to XSLT and then to pdf or is there any other way to do in C# [closed]
Can someone help me to figure out how we can convert a html data or string to XSLT and then convert to pdf or is there any other way to do in C#.I need to map the values we have in html to pdf. Please ...
0
votes
0
answers
21
views
Rotating bitmap and keeping track of location on new image C#
If I rotate a bitmap and want to keep track of a point on the original image as translated on the new image, how would I achieve this. I essentially want to know where the top right corner of the ...
0
votes
0
answers
14
views
How to draw a node in some given coordinates
Can`t draw node with specified coordinates on gViewer.
Try to use code from this question Change Node position in MSAGL , but it doesn`t work.
Form form = new ();
GViewer viewer = new (...
0
votes
0
answers
20
views
What is the common way to handle CS8602 in a WPF RelayCommand?
If a nullable property gets used in the Execute part of a RelayCommand, and that property is already checked against null in the CanExecute method, what is the proper way to handle the CS8602: ...