Questions

How can I deploy a C# console application as a single exe?

I have searched for this and there are a number of previous answers but all seem overly complex. I'm new to C# and Windows development in general (previous Mac developer). I have written a simple ...

11 Nov at 10:17

Testing Exception Messages with Shouldly

Is there a way to test the exception messages with shouldly? An example: ``` public class MyException: Exception{ } ``` The method to be tested: ``` public class ClassUnderTest { public void...

11 Nov at 09:23

Change flow of messages in Microsoft Bot Framework

Hello I'm new to Microsoft Bot Framework and I have a question that I couldn't find an answer to. I have a FormFlow that ask the user for some question, after a specific question I want the bot to do ...

11 Nov at 21:5

iText7 Create PDF in memory instead of physical file

How do one create PDF in memorystream instead of physical file using itext7? I have no idea how to do it in the latest version, any help? I tried the following code, but pdfSM is not properly populat...

12 Nov at 04:15

JSON.NET JObject - how do I get value from this nested JSON structure

I have this JSON: ``` { "client_id": "26075235", "client_version": "1.0.0", "event": "app.uninstall", "timestamp": 1478741247, "data": { "user_id": "62581379", "si...

6 May at 05:29

Mocking Task.Delay

I have a method with the following line: `await Task.Delay(waitTime).ConfigureAwait(false);` I there a good strategy to avoid actually waiting the few seconds when unit testing and instead verify tha...

10 Nov at 22:16

Ensure deferred execution will be executed only once or else

I ran into a weird issue and I'm wondering what I should do about it. I have this class that return a `IEnumerable<MyClass>` and it is a deferred execution. Right now, there are two possible consumers...

20 Jun at 09:12

Web API 2 routing - Route attribute

Question is regarding defining custom routes with the `Route` attribute. I know that in the `WebApiConfig` class you always define the default route, ``` configuration.Routes.MapHttpRoute("API Default...

How to extend IdentityUser with custom property

I'm using asp.net Identity 2.0 for users to log into my website, where the authentication details are stored in an SQL database. Asp.net Identity has been implemented in a standard way as can be found...

How can I support the Redis sentinel architecture using StackExchange.Redis?

My application uses the `StackExchange.Redis` package and I started using the sentinel architecture in order to support high availability and failures. I've search the web, trying to find the correct...

The AuthorizationPolicy named: 'Admin' was not found

I am learning Authentication/Authorization in .NET Core MVC. I am trying to create a controller that can only be accessed by 'Admin', but get the following error. > An unhandled exception occurred ...

Is it possible to catch net::ERR_BLOCKED_BY_CLIENT?

So on our site we have various searches some of which work fine and return the appropriate results. A few of them however return the javascript error: > Failed to load resource: net::ERR_BLOCKED_BY_C...

23 May at 12:6

How to configure AppHostBase virtual methods?

AppHostBase has two overridable methods where you can configure your inherited Application host - `Init()`- `Configure(Container container)` Is there a rule to know which is better? For instance: ...

10 Nov at 10:8

ASP.Net Core: X-Frame-Options strange behavior

I need to remove `X-Frame-Options: SAMEORIGIN` header from some of my actions which should render a content for an iframe. As long as it is added to requests by default I disabled it in `Startup.cs`: ...

27 Nov at 01:31

Hangfire DisableConcurrentExecution: What happens when the timeout expires?

Per the [Hangfire 0.8.2 announcement post](http://hangfire.io/blog/2014/05/21/hangfire-0.8.2-released.html), Hangfire has a `DisableConcurrentExecution` filter which, when applied to a method, prevent...

9 Nov at 21:2

Can't find project classes/methods in test project

In my namespace `Draughts` I have two projects, `Draughts` and `Draughts.UnitTests`. When I try to access `Draughts` methods/classes in `Draughts.UnitTests` it can't find anything at all. At the top o...

9 Nov at 20:36

How to publish messages asynchronously to MSMQ in .NET Core?

There doesn't seem to be a client available, or maybe I'm just looking in the wrong namespace. How is this expected to be done, or is the answer that I have to find another message service?

9 Nov at 20:0

Difference between .Net Core, Portable, Standard, Compact, UWP, and PCL?

I've heard of - - - - - - All of these were explained to me as . So my questions are 1. What's the difference!? 2. If I want to write a library that's usable to as large an audience as possible,...

ServiceStack Message Filtering

I have been using the ServiceStack MQ Server/Client to empower a message based architecture in my platform and it has been working flawlessly. I am now trying to do something that I do not believe is ...

9 Nov at 17:29

Getting property attributes in TagHelpers in ASP .NET Core

Some of model properties has "Required" data annotation, that I need to read in a TagHelper class. In the sales view I create a custom select for customer: And in the CustomerTagHelper class there is ...

6 May at 18:51

What is the difference between an orm and ADO.net?

I am reading a book and it says : "if you will create your own data access layer by using ADO.NET for access into you database, you will be minimally affected whether the data schema exists or not. I...

Control lifetime of .NET Core console application hosted in docker

Disclaimer - this is almost the same question as [docker container exits immediately even with Console.ReadLine() in a .net core console application](https://stackoverflow.com/q/38549006/685341) - but...

23 May at 11:47

Why am I unable to debug a dynamically loaded assembly?

I am working on a Web API project that uses an in-house mocking framework that allows to intercept and modify the responses from the controllers. It uses MEF to loading an assembly that contains code ...

How EXACTLY can += and -= operators be interpreted?

What exactly (under the hood) do the `+=` and `-=` operators do? Or are they implicit in that they are defined per type? I've used them extensively, it's a very simple feature of the syntax, but I'v...

10 Nov at 06:1

.NET WebSockets forcibly closed despite keep-alive and activity on the connection

We have written a simple WebSocket client using System.Net.WebSockets. The KeepAliveInterval on the ClientWebSocket is set to 30 seconds. The connection is opened successfully and traffic flows as ex...

9 Nov at 08:51