Questions

How to replace Assert.Fail() with FluentAssertions

We are currently converting some code that was using `Assert.IsTrue()`, `Assert.AreEqual()`, `Assert.IsNotNull()`, etc. The basic unit test assert Library for C# We want to use FluentAssertions, like...

How to correctly block on async code?

I have tons of code written in following manner: ``` public string SomeSyncOperation(int someArg) { // sync code SomeAsyncOperation(someArg, someOtherArg).ConfigureAwait(false).GetAwaiter().Ge...

12 Jul at 12:5

Using app.config in .Net Core

I have problem. I need to write a program in .Net Core(C#) which use app.config like this: ``` <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="custom" ty...

11 Jul at 21:42

AddDbContext not available in IServiceCollection in .NET Core

I have .NET Core 2 project in Visual Studio 2017. I am trying to add (Postgresql) database connection. Here is a code: ``` public void ConfigureServices(IServiceCollection services) { services.Ad...

appsettings.json in ASP.net Core 2.0 Preview configuration GetSection null

I was trying to call `GetSection` from injected configuration in the `Startup.cs`. The Value was `null`, while `indexer` to a concrete section value returns `non-null` value. It seems to me a bug behi...

11 Jul at 10:13

Start host for integration test from test base throws not implemented exeption

``` public class IntegrationTestBase : IDisposable { protected readonly ServiceStackHost appHost; public const string BaseUri = "http://localhost:5000/"; public IntegrationTestBase() ...

How to check Azure function is running on local environment? `RoleEnvironment` is not working in Azure Functions

I have a condition in code where i need to check if current environment is not local.i have used `!RoleEnvironment.IsEmulated`, now this is not working in Azure functions but works in Cloud service. ...

Using Application Insights with ILoggerFactory

I'm trying to log exceptions to Application Insights. I succeeded in doing this by calling `TelemetryClient.TrackException` directly. However, I would like to abstract away from this in my code in cas...

Overriding ServiceStack Templates with Embedded Resources

Service stack documentation explains that templates for meta and operation pages may be overridden using static files. [https://github.com/ServiceStack/ServiceStack/wiki/Virtual-file-system](https:/...

10 Jul at 21:45

'Could not load file or assembly 'netstandard, Version=2.0.0.0, ...'. Reference assemblies should not be loaded for execution

From a .NET 4.7 console app, using reflection with Assembly.GetType(), I am trying extract the Type of a netstandard 2.0 class from Assembly X. Then I want to create an instance of this Type with Act...

Upsert support in ORMLite

I am using ORMLite in my project. What is the best way in ORMLite to perform UPSERT? Is there any built-in functions to do this type of operations? Thanks rudrvij

6 Mar at 14:14

ASP.NET Core and formdata binding with file and json property

I have the following model: ``` public class MyJson { public string Test{get;set;} } public class Dto { public IFormFile MyFile {get;set;} public MyJson MyJson {get;set;} } ``` On th...

10 Oct at 10:58

Assert an Exception using XUnit

I am a newbie to XUnit and Moq. I have a method which takes string as an argument.How to handle an exception using XUnit. ``` [Fact] public void ProfileRepository_GetSettingsForUserIDWithInvalidArgum...

10 Jul at 16:47

FluentValidation validate Enum value

I have the following model: ``` public class ViewDataItem { public string viewName { get; set; } public UpdateIndicator updateIndicator { get; set; } } ``` With the following enum: ``` pub...

Asp.Net core long running/background task

Is the following a correct pattern to implement long running background work in Asp.Net Core? Or should I be using some form of `Task.Run`/`TaskFactory.StartNew` with `TaskCreationOptions.LongRunning`...

19 Sep at 03:49

Use Project Reference in Debug and Nuget in Release

I would like to work in my project (A) and a dependent Nuget package (B) at the same time, without the need to release the nuget package on each change. Is it possible to do a project-reference the N...

10 Jul at 09:34

Authentication and Authorization with ASP.NET Core and Service Stack

I have a ASP.Net Core MVC Web App that users needs to logon to get the id_token from the IdentityServer4 and then that id_token will be passed to webapi implemented in ServiceStack to obtain the autho...

Selenium - stale element reference: element is not attached to the page

I am trying to understand why it gives an error while I am trying to display items that took from websites. I am also using google chrome for a browser. ``` chromeDriver.Navigate().GoToUrl("somewebsi...

ServiceStack InProcessServiceGateway throws ValidationException

I am trying to implement service gateway pattern according to [Service Gateway](http://docs.servicestack.net/service-gateway) tutorial to support in-process handing via InProcessServiceGateway and ext...

9 Jul at 18:19

How can I dismiss the on screen keyboard?

I am collecting user input with a `TextFormField` and when the user presses a `FloatingActionButton` indicating they are done, I want to dismiss the on screen keyboard. How do I make the keyboard go ...

26 Dec at 09:26

No restricted globals

I am using React and Redux to develop a webapp and when I started up my project I got this: ``` Line 13: Unexpected use of 'location' no-restricted-globals Search for the keywords to learn more ab...

Lambda including if...elif...else

I want to apply a lambda function to a DataFrame column using if...elif...else within the lambda function. The df and the code are something like: ``` df=pd.DataFrame({"one":[1,2,3,4,5],"two":[6,7,8,9...

21 Nov at 02:32

Generating a PDF file from React Components

I have been building a polling application. People are able to create their polls and get data regarding the question(s) they ask. I would like to add the functionality to let the users download the r...

18 Sep at 13:19

SPA client accessing ServiceStack session

I am developing a SPA in Angular 4 backed by ServiceStack based web services and wanted to enable the SPA to check if the user is already authenticated using the Redis cache client implemented in the ...

8 Jul at 15:42

Android Room Database: How to handle Arraylist in an Entity?

I just implemented Room for offline data saving. But in an Entity class, I am getting the following error: ``` Error:(27, 30) error: Cannot figure out how to save this field into database. You can con...

17 Dec at 04:58