typescript: error TS2693: 'Promise' only refers to a type, but is being used as a value here

I am trying to use Typescript for my AWS Lambda and i am getting the following errors where ever I use promises. I tried using the following variations in the code Using the Promise constructor ...

24 Jul at 18:32

Injecting Single Instance HttpClient with specific HttpMessageHandler

As part of an ASP.Net Core project that I am working on I have a requirement to communicate with a number of different Rest based API Endpoints from within my WebApi. To achieve this I am using a num...

TypeScript filter out nulls from an array

TypeScript, `--strictNullChecks` mode. Suppose I have an array of nullable strings `(string | null)[]`. What would be a way to remove all nulls in a such a way that the result has type `string[]`? ``...

5 Jul at 12:55

Is Microsoft.AspNet.WebApi.Client supported in .NET Core or not?

I'm currently trying to do some JSON formatting using the HttpClient in .NET Core and MediaTypeFormatters. Especially the function "ReadAsAsync(..., MediaTypeFormatter, ...)" ([https://msdn.microsoft....

4 Dec at 22:15

Can I make a CSS grid with dynamic number of rows or columns?

What I wanna do is to make a [CSS grid](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout) with a dynamic number of cells. For the sake of simplicity, let's assume there will always be ...

7 Feb at 10:4

Type 'void' is not assignable to type 'ObservableInput<{}>'

This error started to pop up after I migrated to TS 2.2.2, so I'm assuming that's the problem... The code did not stop working, but now I receive that error and I tried a few things like returning an ...

30 Mar at 11:5

Typescript : require statement not part of an import statement

Typescript version 2.2.2 I wrote this require in my UserRoutzr.ts ``` const users = <IUser[]> require(path.join(process.cwd() + "/data")); ``` TSLint is raising the following warning: ``` require...

30 Mar at 08:39

is it possible to unload an Assembly loaded dynamically in dotnet core?

in .net framework was possible to load an assembly in separate AppDomain then unload it. In .NET core AppDomain not available and replaced by `AssemblyLoadContext`. I can load assembly to `AssemblyLoa...

4 Jun at 03:43

How to detect tablet mode

I'm using the following code to detect if a user is in tablet mode or not. I'm on a Surface Pro and when I decouple the keyboard and make the PC into a tablet, `IsTabletMode` returns true (which it sh...

5 Aug at 17:40

How to declare a C# Record Type?

I read [on a blog](https://www.codeproject.com/Articles/1131035/New-Features-of-Csharp) that C# 7 will feature record types ``` class studentInfo(string StudentFName, string StudentMName, string Stud...

22 May at 09:15

C# Method overload resolution not selecting concrete generic override

This complete C# program illustrates the issue: ``` public abstract class Executor<T> { public abstract void Execute(T item); } class StringExecutor : Executor<string> { public void Execute(...

29 Mar at 23:9

Ignoring exceptions when using c# selenium webdriverWait wait.untill() function

In order to check if an Element is exists and clickble i'm trying to write a boolean method which will wait for the element to be enabled and displyed using C# selenium's webDriverWait as follow: In c...

How to invoke async methods in Hangfire?

I have asp.net core API application and this is the first time i will be using HangFire. In .Net Core application all my methods are async. Based on [SO Post](https://stackoverflow.com/questions/3265...

17 Jul at 15:54

Three gray dots under variable names in Visual Studio

![Two variable names with three gray dots under each of them](https://i.stack.imgur.com/xiexo.png) What do these three gray dots mean? I recently updated to Visual Studio 2017, and I haven't ever see...

29 Mar at 17:20

Path.GetRandomFileName vs Path.GetTempFileName

Base on recommendation from https://msdn.microsoft.com/en-us/library/system.io.path.getrandomfilename(v=vs.110).aspx I have replaced GetTempFileName with GetRandomFileName to get a name for the temp f...

7 May at 03:57

How to truncate or pad a string to a fixed length in c#

Is there a one-liner way of setting a `string` to a (in C#), either by it or it with spaces (`' '`). For example: ``` string s1 = "abcdef"; string s2 = "abc"; ``` after setting both to length `...

26 Oct at 19:39

how to refresh token servicestack typescript

On servicestack it says that for regular client it should be like that but for typescript it should be somehow different. Anyone knows how to do it? ``` var client = new JsonServiceClient(baseUrl); c...

30 Mar at 07:37

Setting index.html as default page in asp.net core

How can I get asp.net core to serve an index.html file from inside my wwwroot? The reason I want to do this is because I an developing an angular 4 app using the angular CLI and it takes care of the ...

29 Mar at 10:42

When does a C# Task actually start?

When does a Task actually start? ``` public void DoSomething() { Task myTask = DoSomethingAsync(); Task.WaitAll(new[] { myTask }, 2000); } public async Task DoSomethingAsync() { await S...

29 Mar at 09:19

Entity Framework Core jsonb column type

I am using Entity Framework Core with npgsql postgresql for Entity Framework Core. My question is, using migrations, how do I mark a class property to generate a JSONB column type? For example: ```...

How to add a generic dependency injection

Working on a read-only api service and making use of generics to package the operation into convention based process. Repository interface: ``` public interface IRepository<TIdType,TEntityType> wher...

Prevent IDM from downloading automatically in web api

I have a web api method that returns an `HttpResponseMessage` containing a PDF file. The method looks something like this: ``` HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK)...

17 May at 10:8

Use body stream parameter in WebApi controller's action

I currently read input stream from body like this: ``` public async Task<IActionResult> Post() { byte[] array = new byte[Request.ContentLength.Value]; using (MemoryStream memoryStream = new ...

C# 7 tuples and lambdas

With new c# 7 tuple syntax, is it possible to specify a lambda with a tuple as parameter and use unpacked values inside the lambda? Example: ``` var list = new List<(int,int)>(); ``` normal way to...

23 May at 12:26

ServiceStack Utility to read from Custom Config Sections

Is there any ServiceStack utility that can read from custom config sections. ServiceStack has IAppSettings which makes it easy to read from appSettings in a config file. I am wondering if ServiceStack...

28 Mar at 22:3