Visual Studio 2017 unable to load project

I'm trying to load my VS2015 project into the newly installed VS2017RC but it keeps giving me the error (when loading or reloading): > Object reference not set to an instance of an object. It also...

How to update values into appsetting.json?

I am using the `IOptions` pattern as described [in the official documentation](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration#using-options-and-configuration-objects). This ...

3 Feb at 17:57

What is the best way to save game state?

I find the best way to save game data in Unity3D Game engine. At first, I serialize objects using `BinaryFormatter`. But I heard this way has some issues and is not suitable for save. So, What is the...

16 Sep at 09:56

An error occurred attempting to determine the process id of dotnet.exe which is hosting your application. One or more error occured

I have clone the project from source url. My friend has developed the asp.net core web application using .NetCore 1.0.0-preview2-003121 sdk. However on my pc I have install .NetCore 1.0.1-preview2-003...

19 Mar at 15:28

My C# program is detected as a virus?

I have created a C# program and I recently noticed that when I merge my referenced .dlls into one executable .exe file using IL Merge, my Anti Virus (Avast) immediately deletes it and says that it's a...

4 Dec at 15:48

How to generate class diagram from models in EF Core?

We are building an application using ASP.NET MVC Core and Entity Framework Core and we have the whole bunch of classes in our application. In previous versions of Entity Framework, we would use this m...

4 Dec at 07:10

Define a column as nullable in System.Data.DataTable

I need to define a `System.Data.DataTable` in C# VS2013; in one column, it may be int or null. But I got: > DataSet does not support System.Nullable<>. For the definition: ``` public DataTable myDataT...

10 Jun at 07:37

IMemoryCache Dependency Injection outside controllers

I have an ASP.NET Core MVC Project with an API. I then have a Class Library in the same solution named My API calls a repository method inside the Class Library Infrastructure, in the class `UserRe...

3 Dec at 11:32

Injecting multiple implementations with Dependency injection

I'm currently working on a ASP.NET Core Project and want to use the built-in Dependency Injection (DI) functionality. Well, I started with an interface: ``` ICar { string Drive(); } ``` and wa...

Local function vs Lambda C# 7.0

I am looking at the new implementations in [C# 7.0](https://blogs.msdn.microsoft.com/dotnet/2016/08/24/whats-new-in-csharp-7-0/) and I find it interesting that they have implemented local functions bu...

4 Jun at 09:8

OrmLite is not recognizing Unicode in JSON field

Ormlite doesn't seem to recognize unicode strings (Arabic) that are stored inside the new 'json' field in MySql. I'm using MySql 5.7 engine .. Arabic is working for all other fields .. stored correctl...

Is the 'volatile' keyword still broken in C#?

Joe Albahari has a [great series](http://www.albahari.com/threading/) on multithreading that's a must read and should be known by heart for anyone doing C# multithreading. In part 4 however he mentio...

2 Dec at 18:27

How to set a default value on a Boolean in a Code First model?

I have an existing table / model into which I want to drop a new Boolean column. This table already has many hundreds of rows of data, and I can't touch the existing data. But.. This column will NOT b...

2 Dec at 18:46

Custom serialization in Service Stack using DeSerializeFn

In servicestack, I am trying to process a webhook which sends the following JSON body to a service stack endpoint: ``` { "action": "actionType1", "api_version": "1.00", "data": { "id": "a8d316b8-...

2 Dec at 20:22

Visual Studio 2017 Compiler Error(s)

I just upgraded to VS2017 but right off the bat my project can no longer be built, as I am getting a bunch of strange compiler errors that didn't exist when I was using VS15. Errors such as: - `Syntax...

20 Jun at 09:12

Servicestack - Passing information between sessions

I have implemented a custom AuthenticateAttribute, AuthUserSession and CredentialsAuthProvider. In the Execute method of my AuthenticateAttribute I do: ``` public override void Execute(IRequest reque...

2 Dec at 12:42

ASP.NET Core 1.1 compiling with C# dynamic Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create'

I'm using Visual Studio 2017 RC and started a new ASP.NET Core project targeting the full .NET Framework. This line of code will not compile. ``` dynamic handler = _container.GetService(handlerType)...

3 Dec at 13:53

How to set up Swashbuckle vs Microsoft.AspNetCore.Mvc.Versioning

We have asp.net core webapi. We added `Microsoft.AspNetCore.Mvc.Versioning` and `Swashbuckle` to have swagger UI. We specified controllers as this: ``` [ApiVersion("1.0")] [Route("api/v{version:apiV...

8 Jan at 15:47

Restrict generic extension method from extending strings

I have a very generic extension method to show any type of list within a console: ``` public static void ShowList<T>(this IEnumerable<T> Values) { foreach (T item in Values) { Console...

2 Dec at 10:43

NSubstitute test works by itself, but throws Unexpected Matcher Argument in a suite

I have a unit test where I use .Returns() to return some sample data: ``` [TestMethod] public void TestRetrieveElementsInVersion() { IRetrieveElementSequence component = Substitute.Fo...

2 Dec at 00:23

Content-Type must be 'application/json-patch+json' JsonServiceClient ServiceStack

I'm trying to perform a patch with a JsonServiceClient to a service stack api as follows: ``` var patchRequest = new JsonPatchRequest { new JsonPatchElement { op = "replace", ...

2 Dec at 15:33

Allow System.Windows.Forms.WebBrowser to run javascript

Seriously - "Use a different browser" doesn't answer this question. The question is this: I've already seen people suggest adding registry values for IE emulation ([Allowing javascript to run on ...

CORS issue with C# Servicestack and NodeJS

I am having an issue with CORS through Servicestack C# API. I have an angularjs application that is being served up through a nodejs back-end running on a Microsoft Server. NodeJS serves up the angula...

1 Dec at 22:36

Why is my api key null with ServiceStack ApiKeyAuthProvider?

Here is my Auth config: ``` container.Register<IAuthRepository>(c => new OrmLiteAuthRepository(c.Resolve<IDbConnectionFactory>())); container.Resolve<IAuthRepository>().InitSchema(); Plugins.Add(new ...

1 Dec at 16:51

Reflection - Call constructor with parameters

I read type from loaded assemblies for example: ``` var someType = loadedAssemblies .Where(a => a != null && a.FullName.StartsWith("MY.")) .SelectMany(a => a.GetTypes()) ...

1 Dec at 15:56