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.
136
questions
0
votes
0
answers
7
views
Program exit with code 0 on if (await db.Database.CanConnectAsync())
I have a C# Console App with the following Main (lightly trimmed):
public static void Main(string[] args)
{
Start(args);
}
private static async void Start(string[] args)
{
new ...
0
votes
0
answers
6
views
WPF style trigger of usercontrol not propagated
I built a CustomDataGrid usercontrol based on the DataGrid where I define the DataGridCell style trigger to alternate the background color of odd vs. even selected cells as follow:
<...
0
votes
0
answers
4
views
How can I take high resolutions pictures with my custom camera on newer Android phones with Xamarin Forms?
I'm developing a Xamarin Forms application in the netstandard2.0 framework to deploy both on Android and iOS. The purpose of the program is to create a custom camera to capture and handle high ...
0
votes
0
answers
7
views
Making the player move to the right or to the left when the arrow is clicked in Unity
I was working on a script where, if you click the right arrow, the player moves at a constant speed towards the right side of the screen, then stops after leaving the screen. (Similarly, if you click ...
0
votes
0
answers
16
views
Why are PublicClientApplicationBuilder requires client(app) Secret?
My final goal is manage user's access token by refresh token.
I need token from user.
So, I tried this logic.
var app = PublicClientApplicationBuilder.Create(clientId)
.WithRedirectUri(redirectUri)...
0
votes
0
answers
10
views
Azure AD should support logging into the callback url in Blazor
@page "/authentication/{action}"
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
@using Microsoft.Extensions.Logging
@attribute [AllowAnonymous]
@layout EmptyLayout
@...
0
votes
1
answer
28
views
building generic property selector / setter in C# if you only know the type at runtime
I'm working with API that want expressions as parameters to identitfy/modify properties on an object. This works fine if I know the type at compile Time. E.g. the APi requires an Expression<Func<...
0
votes
0
answers
6
views
Draw renderer-line only on roads
I was wondering if its even possible to make my line renderer to been drawn only on the road asset, the problem im having its that I bought this asset and the road are combined with street.
Is there ...
0
votes
1
answer
10
views
WPF DataContext PropertyChanged is Null
I have two WPF components, one is containing a list of the other one.
I set the DataContext in the parent WPF component, so I can define a property.
Unfortunately, the PropertyChanged of my model is ...
-1
votes
0
answers
12
views
Change PhysicalFilesWatcher polling interval
The PhysicalFilesWatcher, which is being used when setting the UsePollingFileWatcher = true in PhysicalFileProvider, has a default polling interval of 4 seconds.
Is it possible to change this interval?...
-1
votes
0
answers
16
views
Correct way of COM port paralleling
I have to make a program in C# to program some micro controllers. The controllers a programmed via a UART to USB adapter that windows recognizes as a COM device.
The programming is fairly simple, I ...
0
votes
0
answers
13
views
How to manage connected users in a multi-server C# socket console application?
I have a C# console based application deployed on ubuntu servers (3 instances at the moment). I have redis server which has a SET for keeping all connected user ids (ulong).
I have logic in place to ...
0
votes
0
answers
19
views
In .NET 9, serialization of style using XamlWriter and XamlReader throws exception
In .NET 9, serialization and deserialization of style using XamlWriter and XamlReader throws exception. But in .NET 8 and other framework versions, it works fine. Please find the code below.
In .NET 9,...
0
votes
0
answers
21
views
How can I send the same query to multiple database hosts in a parallel way in ASP.NET Core? [closed]
I need to take a Json file full of connection strings and use it to send the same query to all of the databases.
My goal is to use Task for it and then Task.WhenAll() for getting all the results and ...
0
votes
0
answers
5
views
Verify.Attributes.cs(14,12): Error CS0579 : Duplicate 'VerifyXunit.UseVerifyAttribute' attribute
I recently added Verify for xUnit to my test project. Now it fails to compile:
Verify.Attributes.cs(14,12): Error CS0579 : Duplicate 'VerifyXunit.UseVerifyAttribute' attribute
I tried downgrading to ...