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,058
questions
0
votes
0
answers
7
views
How to show debug logs while running blazor hybrid app on local android device?
I am using VS2022 Community Edition on Windows 10. I have followed this tutorial https://learn.microsoft.com/en-us/dotnet/maui/android/device/setup?view=net-maui-8.0 and have gotten my blazor hybrid ...
0
votes
0
answers
18
views
Differences between dotnet build -r and dotnet publish -r
With the following project file:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
</PropertyGroup>...
0
votes
0
answers
10
views
Data resolution are not changing when try to minimize the resolution
In Firefox browser, when opened in normal form all data moves towards right, while it appears correctly in Chrome and Edge. Also when I tried to minimize the resolution in edge or chrome all data ...
0
votes
0
answers
10
views
.Net 8 Blazor Web App (server) -> Start with browser language and allow user to change language via dropdown
What I want to achieve
I want my Blazor Web App (server rendering) to start with translations that fit to the browser language but also offer a language selection to the user to change the app ...
0
votes
0
answers
16
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
2
answers
25
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
0
answers
14
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, ...
-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?
-3
votes
0
answers
13
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
16
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 (...
1
vote
0
answers
28
views
How to make a redirect after Login into Account
I use JWT token, send a request to receive a token, receive a token, how can I make a redirection in a convenient form after successfully completing the authentication procedure? I tried to do this ...
0
votes
0
answers
10
views
Connecting Client and Host grave issues in unity multiplayer game
Where do I even begin with this one. I'm currently making a multiplayer game on unity, using Netcode for Gameobjects. I've made sure to check the online functionality after each addition to ensure it ...
0
votes
0
answers
13
views
What is the Mapperly equivalent of AfterMap method in Automapper?
I'm trying to replace AutoMapper with Mapperly in our project due to the latter's performance. However, I'm facing difficulty while replacing AutoMapper with Mapperly because I can't find any ...
-1
votes
1
answer
24
views
Password visibility is not showing in chrome and firefox
I am currently developing a C# application and aiming to ensure compatibility across all major web browsers. However, I've encountered an issue specifically with the password visibility icon. This ...
0
votes
0
answers
22
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: ...
1
vote
1
answer
21
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
votes
0
answers
10
views
I was doing a camera calibration system, based on a series of images
using OpenCvSharp;
using System;
using System.Collections.Generic;
using System.IO;
class CameraCalibration
{
static void Main()
{
Size chessboardSize = new Size(5, 8);
Size ...
0
votes
0
answers
16
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 ...
1
vote
1
answer
36
views
Accessing pointer fields through properties
Is it possible to avoid overhead of property-method call in this case (somehow forcing compiler inline? I know this more like an Alias but there is no such thing in C#):
unsafe public static class ...
0
votes
0
answers
9
views
Unity - How detect dynamic island in Apple phones?
How detect dynamic island in Apple phones?
Or do automatic offset, setup in Unity or Xcode?
I found a similar problem here but it's probably directly for coding in Xcode.
In Xcode, I can only manage ...
0
votes
0
answers
13
views
Validation gets lost on tab change
I am using a tab control to group different input fields like text boxes. I am validating the user input of those text boxes via IDataErrorInfo in my view model.
Now, when the user input is not valid ...
0
votes
0
answers
9
views
How to Close ISWebCombo Dropdown After Selecting a Value with AutoPostback Enabled?
I'm using an ISWebCombo dropdown control in my ASP.NET Web Forms application. The dropdown does not close automatically when I select a value. I need it to close after selection.
<ISWebCombo:...
0
votes
1
answer
10
views
.ASPXAUTH cookie not being read by sub application
I have an asp.net v4.7.2 web app setup at, my.example.com in IIS. It uses asp.net Forms Authentication. It's Web.Config:
<httpCookies requireSSL="true" />
<authentication mode=&...
0
votes
0
answers
26
views
.Net Maui ArgumentException: 'An item with the same key has already been added. Key: Microsoft.Maui.Controls.BindableProperty' - What does that mean?
I'm really at a loss here.
I'm working on a .Net Maui Application for Android and iOS for work. When I open a specific page I sometimes (like, maybe 1 out of 6-10 times) get an Error with this message:...
0
votes
0
answers
19
views
Simultaneous access to the file by many computers from VSTO
I have about 20 comps using my VSTO add-in in MS Word working in local network.
I have to write some statistic from this machines in one xml file common for all of them placeed in shared folder.
How ...
0
votes
0
answers
17
views
Dynamically create Entity,DbSet,Migration file,Migrator file and Tables
I want to dynamically generate the following components based on user input properties:
Entity Class: Create a C# class representing the entity with properties based on user input.
DbSet: Add a DbSet ...
0
votes
0
answers
24
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
1
answer
29
views
C# Dictionary does not contain a definition for sum when using ulong [duplicate]
I have a Dictionary<string, DemoRecord> with DemoRecord having a field Size.
I now want to calculate the sum of all sizes using LINQ. Here's the example
public record DemoRecord(string Name, ...
0
votes
0
answers
29
views
CurveFitting with more than 5 parameters in C#
I would like to fit a curve with 6 parameters using C#. To do this I am using MathNet.Numerics.Fit.Curve. But since it only supports up to 5 parameters, I tried to set one parameter of the function to ...
0
votes
1
answer
11
views
Telerik UI WPF - How Can I Add a DocumentVariableField to a Table Cell Programmatically
We are using Telerik UI for WPF and are creating a table which then gets inserted into a RadRichTextBox. We need to add a DocumentVariableField to one of the cells, can anyone please advise.
...