Category "c++sharp"

Return response with errors instead of throwing exception in validation pipeline mediatr 3

I am currently working with Pipeline behavior in Mediatr 3 for request validation. All the examples that I came across were throwing ValidationException if any

Setting headers for Odata client

I've been trying to set authorization header value for Odata client. After I instantiate the client, I do it like this: container.BuildingRequest += (sender, e

How do I trigger a form to close when it loses focus

I have two forms, form1 and form2. form1 has a button that when clicked opens form2 center screen over form1. form2 is smaller than form1 (on purpose). If the c

C# Incremental Source Generator caching bug?

I'm trying to wrap my head around the new Roslyn Incremental Source Generators, by making a simple generator, that lists all invoked methods in a file called In

Change the headers of static files in Asp.net Core

I am using package Microsoft.AspNet.StaticFiles and configuring it in Startup.cs as app.UseStaticFiles(). How can I change the headers of the delivered files ?

Simple way to add extra parameter to Automapper ForMember

So, I have a mapping ObjectFrom to ObjectTo. ' All mappings can be done ObjectFrom.propX -> ObjectTo.propX2. But there is also a property in ObjectTo that ne

Is there a way in C# to find the current location of a shortcut target programatically?

Windows shortcuts use the Distributed Link Tracking service to get the current location of shortcut target which has moved or renamed when the link is clicked o

How do I implement a global keyboard hook using GTk2 C# Visual Studio on mac?

This is not a duplicate question. I have read lots of implementations of low level / global keyboard hooks using C# but none of them have yet provided a solutio

Why Return Base Method With Blazor OnInitialized Method

I am seeing more and more examples of OnInitialized and OnInitializedAsync() returning base.OnInitialized[Async]. But Why? The examples on the Microsoft websit

Visual Studio C# Get sheet visible property

I'm trying to fill a dictionary with name as key, and an array with codename and if sheet is visible. This is where I ran into a conversion issue with sheet.vis

To filter mails from inbox which are sent to another recipient?

In Outlook Interop, using Outlook = Microsoft.Office.Interop.Outlook; To filter unread emails, I'm using the following code Outlook.Application oApp = new Out

How to search a word in a RichTextBox having specific format?

I have a RichTextBox where the user will copy-paste from MS Word an MCQ quiz question. The correct choice would either be highlighted or with bold text (e.g. in

Unity Addressables: RemoteProviderException : TextDataProvider : unable to load from url /base.apk!/assets/aa/settings.json

I have followed closely the samples for using the play asset delivery in my project as it is from here: https://github.com/Unity-Technologies/Addressables-Sampl

Why are some characters ignored when calling LastIndexOf?

Please take a look at these codes : string str_to_find = "➖➖➖➖➖➖➖➖➖➖\r\n"; string str

HttpContext.User NullReferenceException only on deployed server

I am using formsauthentication on my MVC project and when testing locally using the Visual Studio Development Server everything works as expected. Once deployed

BoDi.ObjectContainerException : Interface cannot be resolved in Specflow test

I have this step in a Specflow test: [Then(@"the enriched messages are written to the LC")] public void ThenTheEnrichedMessagesAreWrittenToTheLC() { var LcA

How to handle security pop-up in outlook using C#

While Automating Outlook using Microsoft.Office.Interop.Outlook a security pop-u is getting displayed saying "A program is trying to access a email folders....

Outlook item change events in C# misfired

I'm developing an Outlook add-in, that communicates with a server via PHP. I'm synchronizing data between Outlook items and server data. Whenever the user mak

scaffold-DbContext , command results in exception: System.Reflection.TargetInvocationException

When attempted to run a scaffold command I am now receieving the exception noted below. It may be important to note that this stopped working all of a sudden. C

C# custom mail server: receive email through socket on local machine

I'm writing unit testing for email validation. I'm trying to write a very simple POP3 email listener (using sockets) so the email can be sent to my local machin