Category "c++sharp"

Check for internet connectivity from Unity

I have a Unity project which I build for Android and iOS platforms. I want to check for internet connectivity on Desktop, Android, and iOS devices. I've read ab

How do I address this MSB6006 csc.exe error (-2146232797) with VS2019?

I just updated my VS2019 community edition to Version 16.7.2. My project started failing to build (maybe link step?) with this error (it was previously buildin

VS2019 Winforms SDK-style project, can't add a new form

VS20019 creates a windows forms project targeting .net framework (.net 4.7.2 namely) as an "old" style project. I have converted a newly created project to SDK

How to color different words with different colors in a RichTextBox while a user is writing and raise an event when that colored text is clicked

When a user writes some words in a rich text box, if that word matches some specific word, than the color of the that word should automatically change. When th

Can I Deserialize a specific field from JSON?

I am writing a method that takes a British post code and returns the Latitude and Longitude of this postcode as a "Location" object. public class Location {

check the site name hosted on IIS using code

My site name is "Flows" on IIS if i search with the name "FLOWS" its not working so is it possible that i can search it without case sensitive. class Program {

How do I see all services that a .NET IServiceProvider can provide?

This is a general question regarding .NET I am given an instance of the IServiceProvider interface, but I have little documentation as to what might be possibl

Apparently Random Error: "Antiforgery token validation failed. The antiforgery cookie token and request token do not match."

Background I have a relatively new ASP.NET Core 2 site. It's running on just one server (Windows Server 2012 R2, IIS 8.5), and I only restart the site once eve

Check if Object is Dictionary or List

Working with .NET 2 in mono, I'm using a basic JSON library that returns nested string, object Dictionary and lists. I'm writing a mapper to map this to a json

Returning default mock results from actual objects' instances

Consider a scenario when you need to write integration tests for the REST API controllers. I use MSTest for this. The logic is following: Create new database, r

What is the difference between connection.Close() and connection.Dispose()? [duplicate]

I noticed that the SQLiteConnection object in System.Data.SQLite owns two similar methods : Close() Dispose() Same for the SQLiteDataReader o

Do you have to put Task.Run in a method to make it async?

I'm trying to understand async await in the simplest form. I want to create a very simple method that adds two numbers for the sake of this example, granted, i

Returning default mock results from actual objects' instances

Consider a scenario when you need to write integration tests for the REST API controllers. I use MSTest for this. The logic is following: Create new database, r

Not able to get Costura.Fody to work, keeps asking for the DLL

I have installed costura.fody into my project using nuget package. I have updated the FodyWeavers.xml file with: <Costura Unmanaged32Assemblies='dllname' U

Identity UserManager CreateAsync does not write to database

It doesn't give any errors or warnings but it doesn't insert in the database. Seems like it's only in memory. Also UserManager's FindByNameAsync can't check use

QR Scanner won't work on iOS devices (Unity)

Please let me start off by saying I have only been programming for about 2 years now. I am somewhat new to it. I am also more of an Android developer than an Ap

Avoiding allocations but without allowing default zero values for value types

Value types in C# can't have a parameterless ctor, as the default behaviour for CLR when creating an instance without parameters is to just zero all the bits. A

How to bind column header to property in ViewModel? (WPF MVVM)

I Have window that have DataContext that is bind to ViewModel object (VM1 for the example). VM1 have a lot of properties and one of them is a string that called

Docker container is not running on given port in dockerfile

I am trying to run my application on docker (Linux container). In my Dockerfile i'm exposing the port 80 Dockerfile FROM mcr.microsoft.com/dotnet/core/aspnet:3.

Project file could not be loaded, data at root level is invalid, no XML in the project

I am trying to run a hello world C# code from command line and this is the batch file. Tried searching for it but most of the questions are about the XML file r