11,338 questions with C#-related tags

Sort by: Updated
5 answers

Custom fonts not working when uploading Maui Android project to Play Store

I have added custom fonts in the font directory of my Maui project's Resources directory and updated the MauiProgram.cs file accordingly. The fonts work fine when I deploy the application using Visual Studio, but when I publish the app and upload it to…

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
4,003 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,338 questions
asked 2024-05-21T16:58:13.6333333+00:00
Mujtaba Ali Panjwani 25 Reputation points
answered 2025-03-13T11:51:28.4433333+00:00
Max Borrmann 5 Reputation points
1 answer One of the answers was accepted by the question author.

Entity Framework v8, on SaveChangeAsyc() intserts record twice

public async Task AddAsync<T>(T entity) where T : class { await _dbContext.Set<T>().AddAsync(entity); // use only context and test await _dbContext.SaveChangesAsync(); } On SaveChangesAsync() 1 duplicate record is inserted.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,338 questions
asked 2025-03-12T13:41:09.5866667+00:00
Reema George Dass 0 Reputation points
accepted 2025-03-13T10:01:17.5633333+00:00
Reema George Dass 0 Reputation points
1 answer

SSIS Script Task: Split a JSON array into a list

I have a JSON array of the form: "data": [ {"tag1": 1,"tag2": 2,"section1": {"tag3": "Dummy"},"tag4": 3,"array1": ["dummy","dummy"]}, {"tag1":…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,338 questions
asked 2025-03-11T14:41:08.5666667+00:00
Peter Bishop 181 Reputation points
answered 2025-03-13T09:40:11.28+00:00
Jiale Xue - MSFT 49,126 Reputation points Microsoft External Staff
1 answer

Cannot Assign x:Name to Elements Inside ContentControl in WPF UserControl

Hello, I have created a UserControl in WPF that contains a ContentControl. This ContentControl can accept any external content (Grid, StackPanel, TextBox, etc.). However, when I use the UserControl in another page and try to assign x:Name to elements…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,338 questions
asked 2025-03-12T10:23:16.67+00:00
fatih uyanık 200 Reputation points
edited a comment 2025-03-13T08:15:53.2466667+00:00
Hongrui Yu-MSFT 4,930 Reputation points Microsoft External Staff
1 answer

Filter on Guid for AppRoleAssignedTo.PrincipalId does not seem to work as expected

See: https://github.com/microsoftgraph/msgraph-sdk-dotnet/issues/2306 Describe the bugUsing C# SDK nuget package Microsoft.Graph 5.40.0. Any time we try to create a filter like var userId = "<GUID VALUE>"; if(!Guid.TryParse(userId,…

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,252 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,338 questions
asked 2024-01-29T10:42:53.76+00:00
Charles Laymon 25 Reputation points
commented 2025-03-13T07:52:29.5733333+00:00
Charles L 86 Reputation points
1 answer

NetworkStream read abends application

I am running into an issue where a read abends my application. Is there a way to handle it in a more soft way so I get the error data, but have it not stop my application. Is it a simply case of changing the LogError functions to a LogInfo? It is…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,338 questions
asked 2025-03-11T21:22:27.76+00:00
Brown, Matt 106 Reputation points
commented 2025-03-13T03:49:10.0333333+00:00
Brown, Matt 106 Reputation points
1 answer

WPF: Why BackgroundWorker.RunWorkerCompleted Event() throw an exception and main thread does not receive it?

Our WPF application targets .NET 4.8. The AbortableBackgroundWorkder class inherences from the BackgroundWorker class and used as following. there are two background workers: _protocolProcessorBackgroundWorker..DoWork() will call …

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,338 questions
asked 2025-03-07T20:07:38.0433333+00:00
Jane Jie Chen 466 Reputation points
commented 2025-03-13T03:08:23.5466667+00:00
Hongrui Yu-MSFT 4,930 Reputation points Microsoft External Staff
1 answer

'The instance of entity type 'Book' cannot be tracked' Error in Entity Framework and Displaying Uncommitted Changes in the UI

Hello, I encountered the following issue while working on my C# WPF project: I make updates to an entity on the UI side but do not send these changes to the database. Later, when listing the entity objects I updated on the UI side, I noticed that…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,338 questions
asked 2025-03-09T11:06:43.0733333+00:00
fatih uyanık 200 Reputation points
commented 2025-03-13T01:04:30.18+00:00
Hongrui Yu-MSFT 4,930 Reputation points Microsoft External Staff
1 answer

Linq Cosmos DB ArgumentNullException Exception

I am using LinQ on the client side to query Cosmos DB. All the other properties work fine except two properties. One is the "id" and the other is the "RowKey". I manually checked the database, the type of RowKeys are all string, they…

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,786 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,338 questions
asked 2025-01-29T19:13:20.8733333+00:00
Yi Gu 0 Reputation points Microsoft Employee
commented 2025-03-12T18:18:25.46+00:00
Yi Gu 0 Reputation points Microsoft Employee
1 answer One of the answers was accepted by the question author.

WPF C# fitting different Screen Sizes

Hi, I'm coding a nice smart tiny app :) and coding on a desktop PC - yesterday Im starting to test a release version and create a setup project - already done. For testing I put the setup file on my old notebook - and ahhhhhhh can't believe it. My…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,338 questions
asked 2025-03-10T22:23:29.0366667+00:00
Jim Jupiter 40 Reputation points
accepted 2025-03-12T11:01:13.6233333+00:00
Jim Jupiter 40 Reputation points
0 answers

How to set clipboard data with the image that is not local when setting?

Hi, I'm trying to implement a feature, "copy" operation in my web APP will call C# dll API to set the image files data into clipboard, the image files don't exist locally, when user do "paste" operation, the app downloads the image…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,338 questions
asked 2025-03-10T15:42:25.72+00:00
kai xiong 21 Reputation points
commented 2025-03-12T09:46:43.5933333+00:00
Jiale Xue - MSFT 49,126 Reputation points Microsoft External Staff
0 answers

My dll cannot be deleted, so deployment fails suddenly

portalWeb deployment task failed. (Web Deploy cannot modify the file 'MyProgram.dll' on the destination because it is locked by an external process. In order to allow the publish operation to succeed, you may need to either restart your application to…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,338 questions
asked 2025-03-12T08:39:37.7433333+00:00
Christina Quast 0 Reputation points
commented 2025-03-12T09:39:40.3733333+00:00
Jiale Xue - MSFT 49,126 Reputation points Microsoft External Staff
2 answers

Microsoft Extensibility SDK for C# for SQL Server

https://learn.microsoft.com/en-us/sql/language-extensions/tutorials/search-for-string-using-regular-expressions-in-c-sharp?view=sql-server-ver16 As mentioned in the above link carried out all the steps. However when I execute below command I am getting…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,338 questions
asked 2025-03-06T10:50:46.18+00:00
Tarale, Sandeep 0 Reputation points
edited an answer 2025-03-12T07:44:35.1533333+00:00
Hongrui Yu-MSFT 4,930 Reputation points Microsoft External Staff
1 answer

SSIS DT_TEXT column contains alternating CHAR(0) characters

I have an SSIS package that is pulling JSON data from a REST source. This was originally pulling data as (DT_STR, 8000, 1252) and writing to a [varchar] column but we have started getting a couple of values than will not fit. I have changed the source to…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,338 questions
asked 2025-03-10T16:13:40.14+00:00
Peter Bishop 181 Reputation points
commented 2025-03-12T06:43:24.1066667+00:00
Jiale Xue - MSFT 49,126 Reputation points Microsoft External Staff
1 answer

Microsoft.Exchange.WebServices.Data (401) Unauthorized error

I have a c# application that is getting the following error: Error: Microsoft.Exchange.WebServices.Data.ServiceRequestException: The request failed. The remote server returned an error: (401) Unauthorized The app failes on the following line:…

Microsoft Authenticator
Microsoft Authenticator
A Microsoft app for iOS and Android devices that enables authentication with two-factor verification, phone sign-in, and code generation.
8,311 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,338 questions
Exchange Server Development
Exchange Server Development
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Development: The process of researching, productizing, and refining new or existing technologies.
573 questions
asked 2022-02-25T20:04:39.793+00:00
Jose Correa 1 Reputation point
edited a comment 2025-03-12T06:41:21.53+00:00
Jack J Jun 24,881 Reputation points Microsoft External Staff
1 answer

Ho to control "Microsoft.Azure.WebJobs.Script.WebHost.Middleware.SystemTraceMiddleware" logs being sent to my Datadaog?

We have integrated the datadog for capturing the azure function application insights logs. Its taking too much of our datadog resources. How to control that? I tried many methods like putting different values in the host.json, But nothing is…

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,532 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,338 questions
asked 2025-02-17T05:24:50.19+00:00
Vijayasundhar Nanjundan 0 Reputation points
commented 2025-03-12T06:03:18.0566667+00:00
Vijayasundhar Nanjundan 0 Reputation points
1 answer

Detecting Microsoft patch updates

Hi All, I am looking for detecting Microsoft patch updates programmatically using C#. The idea is to know the patch update time on the windows machines. Any help is much appreciated. Regards, Pradeep Pasam

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,338 questions
asked 2025-03-07T04:20:44.4133333+00:00
Pasam Pradeep Sabarinadh 0 Reputation points
commented 2025-03-12T02:49:02.6966667+00:00
Jiale Xue - MSFT 49,126 Reputation points Microsoft External Staff
0 answers

Method AppInstallManager.StartProductInstallAsync() not working on a service in release mode

Hi team, I’m trying to download a product using the method appinstallmanager.startproductInstallasync() on my service, but it seems to not be working. Actually, when I use it in debug, it works properly. But when I generate an msix and run it in release,…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,338 questions
asked 2025-03-05T05:06:31.34+00:00
Rhuan Inocêncio 0 Reputation points
commented 2025-03-12T02:39:33.2866667+00:00
Jiale Xue - MSFT 49,126 Reputation points Microsoft External Staff
7 answers

Why are Backspace, Enter, Navigation keys not working while editing any file in Visual Studio?

I am using Visual Studio Extensions, while creating a new solution through extension for the first time, we are only able to type alphabets. Backspace, Enter, Navigation keys are not working while editing any file. But when we force close the solution,…

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,448 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,338 questions
Visual Studio Extensions
Visual Studio Extensions
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Extensions: A program or program module that adds functionality to or extends the effectiveness of a program.
252 questions
asked 2023-02-23T04:57:49.38+00:00
Apurva Kamshetty 25 Reputation points
answered 2025-03-11T12:57:36.24+00:00
טיישר אפרים 0 Reputation points
2 answers One of the answers was accepted by the question author.

What change does the keyword "await" make?

Hello, Without "await" keyword FileStream.ReadAsync return "Task<int>". With "await" keyword FileStream.ReadAsync return "int". Could you please why this happened? What happens behind the scenes?

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,338 questions
asked 2025-03-08T21:56:27.31+00:00
Shervan360 1,661 Reputation points
answered 2025-03-10T16:57:05.1733333+00:00
Bruce (SqlWork.com) 72,276 Reputation points