Why is CS0472 just a warning?
I found a warning CS0472 from the C# compiler. I have this in my code: List<string> list = GetList(); if (list.Count == null) // CS0472 DoA(); else DoB(); Why is it just a warning? IntelliSense tells me that this expression is always…
Issue with saving single record the form saves multiple records until the modelstate is valid
I am using asp.net core 8 i have a popup form when i click submit with empty fields it returns required validation error and when i fill data in fields then submit again it save multiple records is sql database the number of time i click on submit…
SqlDataReader error “Invalid attempt to read when no data is present”
My environment used is Visual Studio 2022 v17.12.4. Language is C# and connecting to SQL Server Express v16.0.1135.2. This is a Windows form using .Net Framework 4.8.1. I am getting the error message “Invalid attempt to read when no data is present”…
How To Print QRCode in Thermal Printer
Hi, can anyone help me with this situation? I'm in need of help printing a QR code using Xamarin.Forms (iOS and Android) (I just need the Android version). I have an Thermal Printer, and im already printing text through the BluetoothSocket, and i can…
I want to lock the current HDMI port in C# WPF (.NET Framework)?
I want to lock the HDMI port. If a HDMI port is used for a monitor then if other HDMI port is used then i want to lock existing port. How to do so in C# WPF?
Unable to Post a Message to Teams Channel with Graph API Client + C#
Hi, We are trying to post a message to teams channel, with Channel.SendMessage delegated permissions. And here is the code snippet. var options = new OnBehalfOfCredentialOptions { AuthorityHost = AzureAuthorityHosts.AzurePublicCloud, ``` }; var…
How to Disable Scrolling in a Navigation View with WindowsAppSDK
I have a WindowsAppSDK app that uses a navigation view control for navigation. For one of the pages, scrolling should be disabled, allowing the page to shrink to fit within the navigation view's content pane. How can scrolling be disabled and the page…
Issue with "Mandatory" package update status in Microsoft Store
Hi, I am experiencing an issue with the Microsoft Store incorrectly reporting "Mandatory" package update status in some of my UWP applications. Following the official documentation, I implemented an update flow in my application that provides…
Windows Community Toolkit AdaptiveGridView incorrect behavior
Hi, has anyone had this problem when using AdaptiveGridView (Win UI platform). The elements do not want to expand to occupy the full width available for them in the row (I attach a photo). I'll leave you the code for setting the AdaptiveGridView so that…
AppDomain.CurrentDomain.BaseDirectory is Empty While Loading Media In WPF
Hello, I am working on a WPF window which supports multiple frameworks <TargetFrameworks>net8.0-windows;net48</TargetFrameworks> i have a media element in a window written <MediaElement x:Name="Video" …
In Azure Web PubSub, How to receive messages in backend microservice for processing
Requirement: My clients are using simple WebSocket connection to send messages. I want to receive these messages inside my backend .NET 8 web api and process them further to send fine-tuned data to some distributed cache services. From documentation, I…
HttpClient // Timeout // The remote name could not be resolved
Hello, The remote name could not be resolved using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri(System.BaseAddress); client.Timeout = new TimeSpan(0, 0, System.Timeout); public void Exception(Exception ex, string…
how to zoom in&out and keep picture aspect ratio?
hi I have a winform app to display a pdf file into a picturebox control. When the user presses the left mouse button and moves the mouse until the mouse is released, a line is drawn. The start and end positions of each line are stored in a list. I want…
System.IO.Ports only availble on windows, but im using windows - .NET6
So i'm trying to read arduino serial from c#, but it shows me the folowing exeption when i try to open the port: System.PlatformNotSupportedException: 'System.IO.Ports is currently only supported on Windows I am currently using windows 11. Also i tried…
How to know whether the snap applied in windows 11 windows. Is there any API.
Is there a method or any API to tell if snap is enabled or disabled in Windows 11? Please answer if there is any other way.
How to fix SystemLoadExecption
Exception has occurred: CLR/System.TypeLoadException An unhandled exception of type 'System.TypeLoadException' occurred in Winappli.dll: 'Could not load type 'Microsoft.Toolkit.Uwp.Notifications.NotificationActivator' from assembly…
The type or namespace 'SharePointOnlineCredentials' could not be found.
How do you resolve this error? I installed SharePoint.Client and SharePoint.Client.Runtime. I referenced Microsoft.SarePoint.Client in my app.
C# Array - getting "System.IndexOutOfRangeException" but dont understand why.
Hi namespace ConsoleApp3 { internal class Program { static void Main(string[] args) { string[] personNamn = new string[3]; personNamn[0] = "A"; personNamn[1] = "B"; personNamn[2] =…
How to Save a WPF DataGrid Back to Database after Editing
Hi, I am wondering if theirs a way to save a updated Line from WPF DataGrid back to Database . I don't Know the best way to do this without going back to WinForms Apps. I would like to use WPF, any help would be appreciated.
I get a permissions error sending email with MS Graph
I am getting a permissions error and not able to find an answer. To be sure, I even set up a second new Azure portal and subscription, again followed the instructions, again got the same error. I must be missing something basic. One of the issues I guess…