Get the name of the currently executing method in dotnet core
I want to get the name of the currently executing method in a dotnet core application. There are lots of examples of how to do this with regular c# eg - [Get the name of the current method](https://...
How to mock IOptionsSnapshot instance for testing
I have class `AbClass` that get with asp.net core built-in DI instance of `IOptionsSnapshot<AbOptions>` (dynamic configuration). now I want to test this class. I'm trying to instantiate `AbClass` cla...
- Modified
- 13 Dec at 00:22
Any reason to use out parameters with the C# 7 tuple return values?
I have just watched a video presenting the [new features of C# 7](https://www.youtube.com/watch?v=5ju2MuqKf_8). Among others, it introduces the possibility to return a tuple type (e.g.: `(int, int)`, ...
How to rewrite URL by middleware in ASP.NET Core MVC
In ASP.NET Core we can use work with the http module to rewrite module like so: How could I rewrite the code above using middleware in ASP.NET Core?
- Modified
- 7 May at 02:11
500 - The request timed out
I have a script that runs for about 4mins30seconds and I have changed the default timeout time to 3600 seconds in the config page of my aspx webpage It didn't return the 500 - The request timed out e...
ServiceStack - Access to the request DTO when using the built-in auth feature?
I'm implementing a web service using ServiceStack and have hit a snag with authorization. Our auth system provides a "per-organization" list of permissions that a user has, with every request DTO the...
- Modified
- 12 Dec at 05:32
What's the difference between System.ValueTuple and System.Tuple?
I decompiled some C# 7 libraries and saw `ValueTuple` generics being used. What are `ValueTuples` and why not `Tuple` instead? - [https://learn.microsoft.com/en-gb/dotnet/api/system.tuple](https://le...
How to implement setInterval(js) in C#
JS's setInterval and setTimeOut is really convenient. And I want to ask how to implement the same thing in C#.
- Modified
- 10 Dec at 23:11
Visual studio is hanging when add a new dataset to RDLC report
I create a specific `report.rdlc` then i want to add new `datatable` to my report . But after changing the data set ,trying to add new dataset to my report . The visual studio is crashing every time...
- Modified
- 10 Dec at 15:17
Remove all Roles from a user MVC 5
Peace be upon you I am trying to remove all roles from a user to disable his permissions and prevent him from accessing some pages. I found this method to remove one role and it worked: ``` await U...
- Modified
- 25 Jun at 01:51
C#: 'IEnumerable<Student>' does not contain a definition for 'Intersect'
It's been long since I write a single line of code so, please, be patient if I am asking a dumb question. Even though the IntelliSense shows the Intersect method after Names, I get the following erro...
- Modified
- 10 Dec at 03:48
How properly generate bootstrap grid via loop using Razor?
I use ASP.NET MVC and bootstrap. I have many objects (>2) in collection and for each need a `<div class="col-xs-6">` but with only 2 cols in a row. How to achive this using loop? There is 1 way but I ...
- Modified
- 9 Dec at 12:44
How and when does Configuration method in OwinStartup class is called/executed?
Before I ask my question I have already gone through the following posts: 1. Can't get the OWIN Startup class to run in IIS Express after renaming ASP.NET project file and all the posts mentioned in...
- Modified
- 23 May at 11:47
Injecting DbContext into service layer
How am I supposed to inject my `MyDbContext` into my database service layer `MyService`? ``` public void ConfigureServices(IServiceCollection services) { services.AddDbContext<MyDbContext>(opti...
- Modified
- 9 Dec at 10:21
ServiceStack return response syntax error
I am just quickly upgrading ServiceStack to version 4.5.4 and I am having a problem trying to convert my service. Basically I cannot longer return the sql response as a string. Does anyone know the co...
- Modified
- 9 Dec at 04:4
IdentityServer "invalid_client" error always returned
I'm trying to use IdentityServer3, but don't know why I'm getting "invalid_client" error always, always no matter what I do. This is the code I'm using: ``` //Startup.cs (Auth c# project) public voi...
- Modified
- 8 Dec at 22:38
Mock IEnumerable<T> using moq
Having this interface, how can I mock this object using moq? ``` public interface IMyCollection : IEnumerable<IMyObject> { int Count { get; } IMyObject this[int index] { get; } } ``` I get:...
- Modified
- 27 Jan at 13:29
Cap string to a certain length directly without a function
Not a duplicate of [this](https://stackoverflow.com/q/2776673/3785314). I want to make a string have a max length. It should never pass this length. Lets say a 20 char length. If the provided string ...
ServiceStack.Redis timeout on Azure
I'm moving my ServiceStack API from Linux/Mono (On my own hardware) to the Azure App Service, using SS 4.5.2. My Redis cache is 3.2 running on a Linux VM. I am using the Azure Redis service. I'm se...
- Modified
- 8 Dec at 19:35
How can I upload a file and form data using Flurl?
I'm trying to upload a file with body content. Is `PostMultipartAsync` the only way? On my C# backend code I have this: ``` var resource = FormBind<StorageFileResource>(); var file = Request.Files....
Why is the Linq-to-Objects sum of a sequence of nullables itself nullable?
As usual, `int?` means `System.Nullable<int>` (or `System.Nullable`1[System.Int32]`). Suppose you have an in-memory `IEnumerable<int?>` (such as a `List<int?>` for example), let us call it `seq`; the...
- Modified
- 8 Dec at 13:32
Fastest way to map result of SqlDataReader to object
I'm comparing materialize time between Dapper and ADO.NET and Dapper. a few result show that Dapper a little bit faster than ADO.NET(almost all of result show that it comparable though) So I think I...
- Modified
- 9 Apr at 12:34
Is there any way to convert .dll file to .cs files
Is there any way to convert .dll file to .cs files? I am searching for any tool or online website what can convert .dll file into .cs files. If any one have any info please inform Thanks in advance. ...
- Modified
- 8 Dec at 12:13
Visual Studio C++/CLI Mysterious Error With Template
Well, I've been trying to make a C++ DLL in Visual Studio 2015, which took a while since I'm not very good with Visual Studio. I need to access the .NET libraries, specifically System::Management. (W...
- Modified
- 8 Dec at 02:31
Query LOCAL Bitcoin blockchain with C# .NET
I am trying to check the of a given Bitcoin address by using the locally stored blockchain (downloaded via Bitcoin Core). Something similar to this (by using NBitCoin and/or QBitNinja), but without ...
- Modified
- 27 Dec at 18:10