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 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.

c#
Filter by
Sorted by
Tagged with
0 votes
0 answers
11 views

UnityEditor.Graphs.Edge.WakeUpObject reference not set to an instance of an object

NullReferenceException: Object reference not set to an instance of an object UnityEditor.Graphs.Edge.WakeUp () (at <77f789c2593a4c2f85795e0341a2e4f5>:0) UnityEditor.Graphs.Graph.DoWakeUpEdges (...
Renars Paura's user avatar
0 votes
0 answers
8 views

How to implement ADFS authentication and Authorization in .Net core

enter image description here Is ASP.Net identity is mandatory for this implementation if we need to use Claims? enter image description here I am getting False value in 'IsAuthenticated' enter image ...
Nina's user avatar
  • 1
0 votes
0 answers
10 views

Aligning items in WPF VirtualizingWrapPanel

I'm experimenting with the VirtualizingWrapPanel by sbaeumlisberger to create an image viewer. Everything is working nicely, I just have a question on the horizontal layout of items. I think it's best ...
Floodlight's user avatar
0 votes
0 answers
7 views

TextBlock inside a grid to output + sign from string non XAML WPF C#

I found many SO solutions to the related problem for XAML but none so far for non XAML case. I have this snippet inside a Grid: System.Windows.Controls.TextBlock textblockButton5 = new System.Windows....
Lod's user avatar
  • 719
0 votes
0 answers
13 views

.NET 7 AES Decryption throws Padding is invalid and cannot be removed error

I am trying to do some (basic?) AES encryption with a variable IV but get garbage back and if the string to be encrypted is too short I get 'Padding is invalid and cannot be removed'. I am including ...
Yohancef Chin's user avatar
0 votes
1 answer
36 views

Is there a way to enforce a specific JSON structure for JSON column?

I have a column in my table that will hold JSON objects. I currently have the column defined as MY_JSON_COLUMN NVARCHAR(MAX) Is there a way to make sure the JSON adheres to a specific structure? For ...
henhen's user avatar
  • 1,105
-5 votes
0 answers
25 views

what are those line things used to seperate brackets in if statements in c# [closed]

making a paddle for breakout and the toturial has something between ((horizontalmovement > 0 && transform.position.x < maxX)(horizontalmovement < 0 && transform.position.x >...
Nate Binns's user avatar
0 votes
2 answers
27 views

Is such a thing available or doable with Dapper to automatically expand the members of a class

Is there a way to do something like this? Let's say I have two classes: public class Class_A { public string Name {get;} public string Age {get;} public int Key {get;} } public class ...
Bohn's user avatar
  • 26.5k
1 vote
1 answer
11 views

EntityFramework & PostgreSQL '...get_Settings()' failed

I got a C# Web API with .NET 6.0 and want scaffold a PostgreSQL database with Entity Framework. While executing the following command im gettin an error with not much information on what could be ...
Joe's user avatar
  • 92
0 votes
0 answers
6 views

How to add configuration from a file in a NuGet package into the config for the project when it is imported?

We have a NuGet package that we have created. The goal of which is to provide common logging and telemetry reporting to each project we import it into. We also want to make this pretty much invisible ...
JTryon's user avatar
  • 33
-1 votes
1 answer
18 views

Im getting a blank screen when running my code in winforms. How do I fix?

I have finished coding and my build succeeds when I run the code however my form1 shows up blank. Below is my code. namespace AccountsApp { public partial class Form1 : Form { private ...
AdrianTB12345's user avatar
0 votes
0 answers
12 views

WPF - Data bindind - data not displayed in custom UserControl

I have a UserControl and I try to have a simple binding working No matter what I do, the data does not display in the control as I run the app public partial class UserControlA: UserControl { ...
phil's user avatar
  • 44
0 votes
0 answers
14 views

Add spinner to right of checkbox on layout

I have the following layout: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:...
Prescott Chartier's user avatar
0 votes
0 answers
2 views

Creating ReportFooter Total in Devexpress Report

I have this report(which is working perfect), but i want to print a SUM(Grand Total) of each productName(i.e: CARGO 0.58, CARGO 0.53, etc) in the ReportFooter. I had used: BeforePrint event to add ...
Luis Moises Rojas's user avatar
0 votes
0 answers
6 views

How to remove AutoSuggestBox delay / debounce?

While using the AutoSuggestBox in e.g. the WinUI 3 Gallery app, I noticed that there is some kind of debouncing on the input. So if one types fast, the results are not updated until one stops typing. ...
me.at.coding's user avatar
  • 16.3k
0 votes
0 answers
9 views

Expandable and collapsable rows in Angular

My main aim is to allow a user to expand a row with child rows when they click on button within a row. However everything seems correct from the data fetching side and the javascript side, but for ...
Kian Chetty's user avatar
0 votes
0 answers
12 views

How to position randomly objects inside box collider area?

after running the game, the objects are not positioned randomly inside the box collider area. they have positioned randomly but a bit far from the box collider. this is the results: i selected all ...
Daniel Lip's user avatar
  • 10.8k
0 votes
1 answer
13 views

How check linq/xml against file when multiple conditions?

I have a project that reads xml of expected build results for each build area, and compares against build logs to see if the build passed. Right now, the linq is showing each condition in a separate ...
Michele's user avatar
  • 3,757
0 votes
0 answers
18 views

Need to pass IServiceProvider as a parameter to constructor of the class

I have a class called as LogAction. In this class I am doing some operation using DI. And that DI is using Iserviceprovider. So in the constructor, initializing the IServiceProvider. public class ...
user876120's user avatar
-2 votes
0 answers
17 views

Non-nullable property 'Nome' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. (CS8618) [Ln 10 [duplicate]

I've just started learning C# and I'm receiving this Error message. I'm following a tutorial, and I've done the same as the video describes. The only diference is that I'm using .NET 8, and teacher, ....
Hugo Aquino's user avatar
1 vote
0 answers
16 views

How can I prevent this exception from stopping the rest of the execution? [duplicate]

Backstory: I am providing students a skeleton of a dll file. In this file, there will be methods that the students need to fill in using .NET C#. The students will take their compiled dll file and put ...
Fr0z3n5un's user avatar
0 votes
1 answer
23 views

Align elements left and right in the same row

In my WPF application using code-behind I am creating some cards using a Border to which I add several elements and I am trying to make the first line have text aligned to the left and a button ...
Juan David Cabezuelo's user avatar
0 votes
0 answers
27 views

Initializing Components in WinForms C#

I'm getting an error when trying to use the InitializeComponents() method. Not sure how to fix it. I tried to go to the solution explorer to see if there was something I could do there but nothing ...
Adrian Narine's user avatar
0 votes
0 answers
15 views

JSON Serialize and Deserialize using different property names in

Using System.Text.Json, I have a client app that only reads properties from a class on my API. My API, calls an external API to get some data first and then returns it to my client app. What I'm ...
RoLYroLLs's user avatar
  • 3,163
0 votes
0 answers
8 views

Duplication ML.NET example/Tutorial movie recommender using matrix factorization

I'm new to machine learning, but I have experience in C#, which is why I want to pick up Ml.net to familiarize myself with the topic. As I grasp the concept, I have decided to make a movie ...
Riddhi Shah's user avatar
0 votes
0 answers
9 views

How to hit a SOAP API via WSDL using .NET?

My current project entails consuming SOAP APIs to upload Case data to a vendor's DB. The vendor supplied WSDL files—one of which is supplied at the end of this body. I referenced this service via WFC ...
Zachary Pataky's user avatar
0 votes
0 answers
13 views

Google Analytics 4 GA4 Send Analytics from C# Visual Studio App

I am trying to send simple google analytics 4 GA4 data from my C# Windows Visual Studio App. I am using the following code. Visual Studio Console is reporting that the data is sent correctly, but my ...
BinDev's user avatar
  • 451
0 votes
0 answers
7 views

Microsoft Graph Api Getting PasswordCreds and ordering them by endDateTime

I'm currently working with the Microsoft GraphApi and I've got the result I want for the most part, but I can't seem to sort them by the passwordCredentials/endDateTime. Now from my understanding is ...
whisk's user avatar
  • 665
0 votes
0 answers
11 views

UI-specific WebView2 vs CoreWebView2Controller; understanding the difference and whether or not it matters

I have a WebView2 control on a Form. I set a user data folder (UDF) and initialize like so: CoreWebView2Environment environment = await CoreWebView2Environment.CreateAsync(userDataFolder: "<...
pushkin's user avatar
  • 9,918
0 votes
0 answers
13 views

When Serilog logger methods throw an exception while writing log to audit file (Serilog.Sinks.File - Auditing via AuditTo)?

My team and I attempt to integrate auditing capability of serilog-sinks-file for our application. We have the requirement to report failures in auditing mechanism. Therefore I try better understand ...
Serhii M.'s user avatar
0 votes
0 answers
7 views

How to a reference my application dbcontext while building a singleton class for DI?

In my .NET 7 Program.cs class I am attempting to use the dbcontext defined earlier as part of the constructor for my singleton class: builder.Services.AddDbContext<ApplicationDbContext>(options ...
Yohancef Chin's user avatar
0 votes
1 answer
19 views

Im trying to load the next level after all objects have been destroyed in my unity game (c#)

Im really new to coding and pretty much I have a game with a cannon at the bottom that shoots moving platforms above. I need to make it so that the next level loads after all the platforms have been ...
jlaw's user avatar
  • 1
0 votes
0 answers
11 views

What's keeping me from running/deleting projects in Visual Studio and Unity?

With Visual Studio, VS Code, and Unity, I keep running into the same two problems (if it matters, I'm coding in C# in all of these). When I'm trying to run (or sometimes even just open) a project, I ...
SvenBTB's user avatar
0 votes
0 answers
26 views

Iban regex to find in text

I have a regex to find regex like following: ^[a-zA-Z]{2}[0-9]{2}\s?[a-zA-Z0-9]{4}\s?[0-9]{4}\s?[0-9]{3}([a-zA-Z0-9]\s?[a-zA-Z0-9]{0,4}\s?[a-zA-Z0-9]{0,4}\s?[a-zA-Z0-9]{0,4}\s?[a-zA-Z0-9]{0,3})?$ ...
barteloma's user avatar
  • 6,649
0 votes
0 answers
18 views

How do I access a variable from different classes?

I have a UserControl Class, a Main Form Class and a DbConn-Class. I want to access the DbConn-Class 'as Middleman' from both other classes. So the UserControl should set a string of the DbConn-Class ...
ElektrischInkorrekt's user avatar
0 votes
0 answers
13 views

How can I get a connection with my bluetooth dongle on my pc and my smartphone to transfer audio via a2dp and avcrp?

I'm doing a study project where I'm supposed to write a Bluetooth integration into an infotainment system in WPF C#. The infotainment system runs on Windows 10. I write a code in c# with 32feet.net ...
Tim Weis's user avatar
2 votes
1 answer
29 views

Can't create a record with Swagger from C# class which has one-to-many relationship

I am trying to create booking type website, using ASP.NET Core API and Angular. I got stuck on models / relations. This is the Hotel model class: public class Hotel { [Key] public int HotelId {...
Qvabby's user avatar
  • 23
0 votes
0 answers
11 views

Unable to compile 2 clients with Chillicream's StrawberryShake

I use StrawberryShake 13.9 in ASP.NET Core 8 / C# and want to consume 2 graphql API from 2 different services which I created with Chillicream's excellent HotChocolate workflow. At client side I have ...
MartiN P.'s user avatar
0 votes
0 answers
9 views

System.ExecutionEngineException when using both ALSA and GLFW

I am writing a c# program that uses both the alsa and glfw c libraries. But whenever a c# callback is invoked by a handler set with snd_async_add_pcm_handler, a System.ExecutionEngineException is ...
Me222282's user avatar
0 votes
0 answers
11 views

How to tell RestSharp to implicitly deserialize DateTime using DateFormatHandling.MicrosoftDateFormat

I'm using RestSharp to make requests in a WebService Connector I'm building. I'm quite new to c# and I searched a lot about this issue but never found a solution. I had problems to deserialize int so ...
Pierrick Martellière's user avatar
0 votes
0 answers
9 views

Join LinqKit.PredicateBuilder across different Tables C#

I am trying to use LinqKit.PredicateBuilder to return if I should display a certain food drink item. My setup is, I have a FoodDrinkType table, FoodDrinkLink table, Enquiry table, EnquiryVenue table. ...
Smac 's user avatar
  • 391
0 votes
0 answers
19 views

TempData in an utility class returns null

I am working on ASP.NET Core 6.0. I have to use TempData in my utility class. So, I am getting it from ITempDataDictionaryFactory as described at How to access TempData in my own utility class? Or ...
Massey's user avatar
  • 1,115
0 votes
0 answers
12 views

How to make a ComboBox pop-up next to a DataGridViewCell when editing that cell

I was wondering whetever is possible to make a ComboBox pop-up next to a DataGridViewCell whenever editing it, this way I could choose from a list of records from my database. Then of course whenever ...
Alex Alexuz's user avatar
0 votes
0 answers
6 views

Error when it is dynamically created (run-time) a new interface type that inherits from another interface built on compilation-time [duplicate]

Given an interface build on compilation-time1 this: public interface Foo {} //[1] Interfaces created during the compilation. public interface FooA : Foo {} //[1] Interfaces created during the ...
Fabio Andrés's user avatar
0 votes
0 answers
8 views

What will PooledConnectionLifetime in HttpClient do with existing connection?

let's say we use HttpClient to make a request and set the PooledConnectionLifetime to 5 seconds as // C# pseudo code, not in the right format var socketsHandler = new SocketsHttpHandler { ...
user22155685's user avatar
1 vote
1 answer
54 views

O(N²) Test Failing

Why do i get a Stack Overflow exception with this: // Calling method: OofNSq(50000); // Method: public static int OofNSq(int n) {     if (n <= 0)     {         return 0;     }     return n + ...
Josh's user avatar
  • 8,401
0 votes
1 answer
20 views

Why is Visual Studio adding the existing project into the .vs folder?

I created a new blank solution in Visual Studio and added an existing project by right clicking the Solution then doing Add -> Existing Project and selecting its .csproj file. Now that I look at my ...
Luis Angel Urena Lopez's user avatar
0 votes
1 answer
33 views

Multiple Users Simultaneously Press Button, Makes Infinite Loop Ineffective on C#

I have a c# infinite loop code on a WinForm project, which uses a value in SQL which alternates between 1/0 and if it's 0 it'll continue the process, while if it's 1 it'll stay in the loop. The ...
MasterOfNothing's user avatar
-2 votes
0 answers
23 views

New Controls not accessible on WPF Code-Behind [closed]

I am currently using VS2022 where I am making as WPF form with C# on .NET Framework 4.8.I am running into an issue with adding new controls to my form. Ill add a new control, lets say a textbox or ...
sdgtc's user avatar
  • 7
0 votes
0 answers
25 views

401 Unauthorized: Consuming web api with JWT authentication in .NET 8 MAUI

I have a webapi .net core 8.0 using JWT authorize, when i try to make a log-in using postman or swagger i can get a JWT token and use then to make a request to a protected end-point, all work ...
Felipe Canuto's user avatar

1
2 3 4 5
32316