Category "c++sharp"

ASP.Net Core Web API ModelState unvalidated when Dictionary used in FromQuery

I have a GET endpoint which accepts a few parameters and a Dictionary in the Query. public IActionResult Get([FromQuery] RequiredFields required, [FromQuery] D

Sendkeys does not work for uploading a folder in selenium c# in headless mode

The code is working fine in normal mode and it silently uploads the entire folder yet when executed in headless mode it does nothing. Just execute the line and

Translation animation between views on xamarin.ios

I'm trying to develop on xamari.ios, the animation consists in the translation of the View, when the swipe gesture is detected, the animation follows the finger

.NET Core stop HostedService in the Integration test

I have .NET Core web API project, for some reasons, we created a background service in this project and start running the background service while the applicati

C# Winform Webbrowser not updating after document text update

Good Morning, I have a Web browser embedded within a C# winform. When loading the web-browser, it loads in a local file and displays the page with no issues. I

How to generate a cryptographically secure random integer within a range?

I have to generate a uniform, secure random integer within a given range for a program that generates passwords. Right now I use this : RNGCryptoServiceProvide

Is there a known algorithm for finding which K elements out of N elements have a sum that is closest to a whole number?

As a small example, say I have N=6 elements { 0.03, 0.25000039, 1.391, 500.1, 0.5000001, 1.75001 } and K=3 then the combination { 0.25000039, 0.5000001, 0.

IBrowserFile FromIMageFileAsync incomplete image

I'm uploading images to my app and I'm using this code: public static async Task<string> GetThumbnailAndImage(InputFileChangeEventArgs e) {

Return JSON string in a normal way

From one method I'm getting string like that one: "{\n \"Name\": \"Next steps for pathway activities\",\n \"Options\": [\n {\n \"Name\": \"Show next s

Memory usage of concatenating strings using interpolated vs "+" operator

I see the benefit of using interpolated strings, in terms of readability: string myString = $"Hello { person.FirstName } { person.LastName }!" over a concate

How to render and preserve <br> tags as line breaks using @Html.TextAreaFor

I'm migrating an ASP Classic app to ASP.Net MVC 5. The legacy data contains <BR> tags in the text. In the old application (still in use) the tags are rend

How to wait for login cookie in C# Selenium WebDriver?

Im only been working with Java before but need to set up some tests in C#. In a login test I like to have a wait method waiting for the login cookie to be set.

Convert String To camelCase from TitleCase C#

I have a string that I converted to a TextInfo.ToTitleCase and removed the underscores and joined the string together. Now I need to change the first and only

C# WEB API CORS does not work

Fighting with CORS. I have a site that is making a simple XmlHttpRequest to a WEB API I built in C#. var xhr = new XMLHttpRequest(); xhr.open("GET","h

Post FromBody Always Null

I've got a new API that I'm building with ASP.NET Core, and I can't get any data POST'ed to an endpoint. Here's what the endpoint looks like: [HttpPost] [Ro

XDocument xmlns url attributes persist to child nodes

Based on this SO solution, adding the same namespace to your child node will prevent creating empty xmlns="" attributes. I'm not getting empty attributes, inste

email address not displaying correctly when importing .pst to mysql using c#

I am using the code below to export an outlook-mounted .pst file called working to a local MySQL database, for the most part the code works fine however some "S

Programmatically get the list of the ribbons using VSTO add-in

I have created a C# VSTO add-in with Visual Studio 2019 that receives commands from a socket connection and it can insert text, modify buttons only in my ribbon

RestSharp body always empty

I need to call a Post service with RestSharp var client = new RestClient(url); var request = new RestRequest(url,Method.POST); request.AddHeader("Content-t

WPF app with embedded WebView2 suddenly shuts down without any visible exception when opening Oookii save file dialog

I'm trying to use an embedded WebView2 control in my WPF application, and open an Ookii VistaSaveFileDialog in response to communication from the webview. Howev