Skip to main content
The 2024 Developer Survey results are live! See the results

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.

0 votes
0 answers
14 views

Passing an array of objects from c# to VBA Excel

I have a c# console application and Dll. I registered the dll as COM via interop. I used the COM Visible property, GUID etc Set Assembly Information, Build information to register it to COM I ...
Dee's user avatar
  • 1
0 votes
0 answers
3 views

Converting Word Document to PDF with Winnovative - Form Fields

I have a word document, that I want to convert to PDF via Winnovative. The basics work, as done with the following function. public byte[] ConvertWordToPdf(Stream fileStream) { var ...
MilConDoin's user avatar
0 votes
0 answers
9 views

Generic way of handling call to multiple api endpoints that use JWT

Setting up an application to call one of a handful of different client api endpoints, each of which use JWT. However, as of now I dont know the specifics of how the specific client might implement ...
bitshift's user avatar
  • 6,570
0 votes
0 answers
11 views

I created a c# Roslyn source generator and a test, the generator works but the test doesn't find the same source

I created a simple source generator that works fine using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Text; ...
Luiz Bicalho's user avatar
0 votes
0 answers
8 views

C# .Net Core Compile only one appsettings.json [duplicate]

In my application often I have three files of settings: appsettings.json appsettings.Development.json appsettings.Production.json When I publish, all three files are brought into the publish folder. ...
erikscandola's user avatar
  • 2,916
0 votes
0 answers
25 views

Access denied trying to execute c# console application

First up, I'll admit I'm a total noob at this. I'm just trying to learn, but it gets hard when I hit this kind of problem. Google hasn't provided any answers so I thought I'd ask here. I built my ...
RobG's user avatar
  • 596
0 votes
1 answer
26 views

Get all keys in a dictionary

I have a collection of objects that contain a dictionary, and would like to extract only the keys and not the values in the dictionary (which are much larger than the keys, unlike in the example below)...
Vladimirs Kacs's user avatar
0 votes
0 answers
8 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 ...
AgentX4000's user avatar
0 votes
0 answers
19 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>...
fharreau's user avatar
  • 2,275
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 ...
Pam's user avatar
  • 15
0 votes
0 answers
12 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 ...
rekcul's user avatar
  • 329
0 votes
0 answers
19 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 for our desktop apps communication) with help of CredentialManagement package on Windows. Now I need to make this ...
bairog's user avatar
  • 3,271
0 votes
2 answers
29 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(); ...
user1151923's user avatar
  • 1,862
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, ...
martian481's user avatar
-1 votes
1 answer
18 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?
Marek Pio's user avatar
  • 107
-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 ...
shalu satheesan's user avatar
0 votes
0 answers
17 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 (...
TA1989's user avatar
  • 11
1 vote
0 answers
30 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 ...
CriticalError's user avatar
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 ...
Bobcat's user avatar
  • 3
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 ...
Rama Rahul's user avatar
-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 ...
Pam's user avatar
  • 15
0 votes
0 answers
24 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: ...
bil-bal's user avatar
1 vote
1 answer
23 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 ...
fharreau's user avatar
  • 2,275
-1 votes
0 answers
13 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 ...
Digital Boost's user avatar
0 votes
0 answers
18 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 ...
Roger Holland's user avatar
1 vote
1 answer
39 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 ...
SuRGeoNix's user avatar
  • 617
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 ...
Lukáš Hotárek's user avatar
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 ...
J. Meyer's user avatar
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:...
parangat's user avatar
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=&...
Vaibhav Garg's user avatar
  • 3,689
0 votes
0 answers
27 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:...
Freddy V's user avatar
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 ...
deku's user avatar
  • 95
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 ...
Guna Krishnamoorthy's user avatar
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 ...
Chris Gedling's user avatar
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, ...
Wouter Vandenputte's user avatar
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 ...
Martin's user avatar
  • 1
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. ...
SteveP's user avatar
  • 425
0 votes
1 answer
21 views

Input validation error foreign key fields

namespace App.Models { public class User { public int Id { get; set; } public string Email { get; set; } public string Password { get; set; } public string ...
ramamoorthy_villi's user avatar
-2 votes
0 answers
67 views

C# How to send Email

I want to use my application to send e-mail. I tried this: try { MailMessage mail = new MailMessage(); mail.From = new MailAddress(form); mail.To.Add(to); mail.Subject = subject; ...
Geometricgame Studio's user avatar
1 vote
1 answer
23 views

How to check for updates in my C# app published on MS Store

I am a Mac developer who has just started building Windows apps. My app will be published to the Windows Store. Do apps downloaded from the Windows Store have to check for new versions themselves, or ...
stapoz's user avatar
  • 13
0 votes
0 answers
23 views

Orleans IPersistentState POCO Namespace Versioning problems

I'm using <PackageReference Include="Microsoft.Orleans.Sdk" Version="8.2.0" /> To generate a serializer for a pretty simple record: namespace BaseNamespace.OldNameSpace; [...
Fernando Urkijo's user avatar
0 votes
0 answers
26 views

Strategy for handling multiple EF Migrations

I need help formulating a strategy for handling situations where two or more team members create an EF migration independently and for different reasons. Every single time we've had this scenario so ...
Captain Kenpachi's user avatar
-1 votes
1 answer
33 views

How does the `CalculateButton_Click` method validate and update `HourlyEmployee` and `CommissionEmployee` properties, and handle input errors? [closed]

I need to understand how the CalculateButton_Click method in my WPF application handles input validation and updates for HourlyEmployee and CommissionEmployee objects. Specifically, how does it check ...
Shivank Panchhi's user avatar
0 votes
1 answer
23 views

How do I implement a scheduled task for file transfer with different start/end time and cleanup?

I find myself in somewhat of a slump with the program I am trying to create. I was given the task of automating a file transfer from one folder to another using C#. I have four source folders, let's ...
lloydi's user avatar
  • 1
1 vote
0 answers
12 views

How do I open a new window on top of other windows using a NavigationViewItem?

Is this a bug in Visual Studio 2022, or am I missing something? I don't know why only using a button opens the window on top like I want it to. Putting a button in the navigation view doesn't look ...
WilliamK's user avatar
0 votes
0 answers
37 views

How to completely hide the title bar in a .NET MAUI application on Windows while retaining resizability?

I am developing a .NET MAUI Blazor Hybrid App for Windows, and I want to hide the default title bar completely while keeping the window resizable. I've tried modifying the MauiProgram.cs file to ...
VQH DEV's user avatar
  • 63
0 votes
0 answers
14 views

Office 365 Power Query framework for developing Excel Add-in [closed]

enter image description here I want to build the similar framework to display the Data on selection of a cell either of the language. Please refer the attached image. Can someone recommend me how can ...
Ashwani Aggarwal's user avatar
0 votes
0 answers
18 views

Sort results of DataView are different in different versions of .Net Framework

The GoodsNo column of the DataView has two pieces of data, HB3-T017 and HB-T015, which are now sorted by GoodsNo, with different results in .Net2.0 and 8.0. The order under .Net2.0 is HB3-T017, HB-...
Tian戊辰's user avatar
0 votes
1 answer
38 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. ...
Ahmad Adief's user avatar
0 votes
1 answer
24 views

How to embed Python to .Net?

I tried to embed Python to .Net using pythonnet based on the docs here and here. Here are my code Runtime.PythonDLL = @"D:\Dev\Console\.conda\python311.dll"; PythonEngine.Initialize(); ...
Syaiful Nizam Yahya's user avatar

15 30 50 per page
1
2 3 4 5
32402