How to handle exceptions in Parallel.ForEach?
I have a `Parallel.ForEach` loop in my code and I am wondering how to handle exceptions. Should I catch and handle(e.g write to log) exceptions inside the loop or should I catch aggregate exception ou...
- Modified
- 15 Dec at 16:37
How to handle errors differently for (or distinguish between) API calls and MVC (views) calls in ASP.NET Core
In my applications based on ordinary MVC and WebApi I had two different error handling routes. If an error occurred during WebApi call, I would intercept it (using standard web api options) and retu...
- Modified
- 12 Nov at 08:37
How to get a Console output in ASP.NET Core with IIS Express
ASP.Net Core documentation [here](https://docs.asp.net/en/latest/fundamentals/logging.html) has a nice console logging output like in the picture below with colors for various LogLevels. I have now cr...
- Modified
- 29 Aug at 00:42
Calling another Web API controller directly from inside another Web API controller
Given a controller `Proxy` and an action of `GetInformation`. I want to be able to call the method `GetInformation` of the `Users` controller. Both the WebAPI controllers are in the same project but...
- Modified
- 20 Oct at 00:7
EF - Cannot apply operator '==' to operands of type 'TId' and 'TId'
I have this generic class, which uses Entity Framework 6.x. ``` public class GenericRepository<TEntity, TId> where TEntity, class, IIdentifyable<TId> { public virtual TEntity GetById(TId id) ...
- Modified
- 23 May at 11:48
Visual Studio - suppress certain "Exception thrown" messages
Can you hide "Exception thrown" messages in output for certain methods (certain code areas)? I use HttpWebRequest for server communication. I periodically check if the server is available (a few times...
- Modified
- 7 Jun at 10:51
Convert Razor String Variable to Javascript String Variable in MVC
I am trying to pass my string variable (even boolean) on my cshtml view to my javascript section. I can successfully pass the value from razor section to javascript if its integer. But what I want to ...
- Modified
- 5 May at 16:53
Using ServiceStack OrmLite to delete rows with condition in other table
I have the following tables in the database: ``` Table C Table B Table A ------- ------- ------- Id Id Id BId AId ``` The BId column is a foreign key to TableB. A...
- Modified
- 19 Oct at 08:33
Entity Framework Core - Lazy Loading
Bowing to my Visual Studios request, I started my latest project using Entity Framework Core (1.0.1) So writing my database models as I always have using the 'virtual' specifier to enable lazy loadin...
- Modified
- 27 Dec at 08:52
What is the attribute in Xunit that's similar to TestContext in Visual studio tests?
We are migrating from visual studio tests to xunit.. In VStests we can access run time test parameters using TestContext. I am looking to set a global variable in the tests supplied at run time from c...
Custom Model Binding in Asp .Net Core
i'm trying to bind a model with a *IFormFile* or *IFormFileCollection* property to my custom class *CommonFile*. i have not found so much documentation on internet about it using asp .net core, i trie...
- Modified
- 19 Jul at 12:18
Set password on Zip file using DotNetZip
I'm using [DotNetZip](https://www.nuget.org/packages/DotNetZip/) to zip my files, but I need to set a password in zip. I tryed: ``` public void Zip(string path, string outputPath) { usin...
- Modified
- 18 Oct at 18:41
Can I block on async code in MVC Core?
We all know [the famous blog post](http://blog.stephencleary.com/2012/07/dont-block-on-async-code.html) regarding blocking on async code by Stephen Cleary. In MVC 5 the following code deadlocks when r...
- Modified
- 18 Oct at 17:24
How do I fix garbled Chinese?
I have a swagger API. How do I resolve the garbled Chinese characters ([GB2312](https://en.wikipedia.org/wiki/GB_2312))? ``` server.ServiceModel.Customer { Email: "test01@*foxmail*.com" Logi...
- Modified
- 20 Oct at 00:17
The user or administrator has not consented to use the application - Send an interactive authorization request for this user and resource
We're doing [this](http://scaleablesolutions.com/web-api-authentication-from-javascript/) CRM Web API project. The project logs-into Dynamics CRM online instance and gets the list of accounts. The lo...
- Modified
- 23 May at 12:9
How to issue and consume JWT using ServiceStack's JwtAuthProvider
Looking at the [JwtAuthProvider documentation](https://github.com/ServiceStack/ServiceStack/wiki/JWT-AuthProvider) for ServiceStack, it seems that a lot of JWT functionality is given out-of-the-box. H...
- Modified
- 18 Oct at 13:25
Reference external DLL in .NET Core project
I've my own .dll file that I used to use with Edge.js in nodejs, I'm trying to use it now with dot net core app, but found no where/no how to get access to it, or define it. is there something like ...
Automatic native and managed DLLs extracting from Nuget Package
This is driving me crazy for several months now and I'm still not able to achieve it. My managed libraries are extracted from the Nuget package but not the natives ones. We have a bunch of managed and...
- Modified
- 20 Jun at 09:12
Best practices to use await-async, where to start the task?
I started to use the await/async mechanism in our .Net WPF application. In my ViewModel, I'm calling an async method on a service. My question is: Is it better to 1. Directly inside this service,...
- Modified
- 18 Oct at 09:19
How to get WPF Window to autosize to content and no more
I have a dialog containing 2 TextBlocks, a Progress Bar and a cancel Button. Here is the XAML: ``` <Window x:Class="WpfApplication4.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xam...
- Modified
- 22 Dec at 13:25
Compiling .net core app with CoreRT / another AOT
I'm building an REST API on ASP.NET CORE 1.0. In production it'd be IMHO very useful NOT to use JIT because the docker containers with the app are scaling up and down, redeploying during CI over and o...
- Modified
- 22 Oct at 09:14
Should I use AddMvc or AddMvcCore for ASP.NET Core MVC development?
I am learning ASP.NET Core MVC from a book, the code snippet in question is as follows: ``` // CHAPTER 4 - ESSENTIAL C# FEATURES namespace LanguageFeatures { public class Startup { publ...
- Modified
- 2 Apr at 16:23
HTTP performance on linux/mono
As there is a bit of code to back up this question - I'll ask it upfront. Are there any known performance issues with a Servicestack self host service (or indeed any http listener) running on linux/m...
- Modified
- 17 Oct at 19:46
Servicestack - UNAUTHORIZED after successful login
I must have missed something, but I get Unauthorized errors for operations that are annotated with `[Authorize]` AFTER a successful login. I tried the annotation on several levels: The service class, ...
- Modified
- 17 Oct at 18:47
ServiceStack Deserializing Interface property null in object
I want to use ServiceStack JsonSerializer. I am setting IncludeTypeInfo property true before I serialize my object.And my serialized string contains all type informations like "__type":".Interfacesb,...
- Modified
- 17 Oct at 17:57