.net-4.5.2

using global exception handeling messes up DelegatingHandler

元气小坏坏 提交于 2019-12-08 07:33:51
问题 When ovveride the IExceptionHandler, the response does not reach the DelegatingHandler when a unexpected exception occurs. How can I fix this? In webapi 2, I want to implement a audit logger for request and response messages. I also want to add a global exception handler. However, when I replace the IExceptionHandler with my custom implementation. the response never reaches the DelegatingHandler -on exception - And thus the audit for response is lost. in WebApiConfig // add custom audittrail

using global exception handeling messes up DelegatingHandler

Deadly 提交于 2019-12-08 06:39:29
When ovveride the IExceptionHandler, the response does not reach the DelegatingHandler when a unexpected exception occurs. How can I fix this? In webapi 2, I want to implement a audit logger for request and response messages. I also want to add a global exception handler. However, when I replace the IExceptionHandler with my custom implementation. the response never reaches the DelegatingHandler -on exception - And thus the audit for response is lost. in WebApiConfig // add custom audittrail logger config.MessageHandlers.Add(new AuditLogHandler()); // replace global exception handeling config

Azure websites with .NET 4.5.2

99封情书 提交于 2019-12-06 09:32:01
According to this semi-official answer here, Azure websites now supports .NET 4.5.2: https://stackoverflow.com/a/23554969/68231 However, when I visit the Kudu debug console, it doesn't show that .NET 4.5.2 is installed: And indeed, when I try to push out a website targeted to .NET 4.5.2, Kudu refuses to build and deploy the website in question, with errors like this: Areas\Integration\Controllers\TwitterController.cs(18,31): error CS0012: The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture

“Use of unassigned local variable” in if statement with TryParse with the use of dynamic

纵饮孤独 提交于 2019-12-05 13:59:25
I've just typed in the following code to a VS2015 .Net v4.5.2 console application: dynamic fromString = "blah", toString = "blah2"; DateTime fromDate, toDate; if (DateTime.TryParse(fromString.ToString(), out fromDate) && DateTime.TryParse(toString.ToString(), out toDate)) { Console.WriteLine(fromDate); Console.WriteLine(toDate); } Somewhat unexpectedly I'm getting the error "Use of unassigned local variable toDate". I didn't expected it because the if statement is only entered if 'toDate' is assigned a value from the second TryParse. Needless to say, it can be worked around by assigning

Force Microsoft Build Tools 2015 to include mscorlib for the targeted version of the framework instead of 4.6

折月煮酒 提交于 2019-12-05 00:51:34
问题 I have written an application in Visual Studio 2015 that uses C# 6.0 features and targets .NET 4.5.2. When I build it using Microsoft Build Tools 2015, which is what is done by our TeamCity server, the resulting bin folder also contains a copy of mscorlib.dll . The problem here is that the mscorlib.dll being copied is the .NET 4.6 DLL, which causes problems at runtime. I have replaced my call to string.Format() with the new string interpolation syntax to work around the problem. That, however

Mock HostingEnvironment.QueueBackgroundWorkItem in xunit test

我的梦境 提交于 2019-12-04 23:15:52
I have a method using HostingEnvironment.QueueBackgroundWorkItem which I wish to unit test some behaviour before this call, however, the test is failing with System.InvalidOperationException : Operation is not valid due to the current state of the object. I suspect this I need to mock the HostingEnvironment but unaware of how to. To resolve this issue I defined an interface public interface ITaskScheduler { void QueueBackgroundWorkItem(Action<CancellationToken> workItem); } In production code I inject implementation public class AspNetTaskScheduler : ITaskScheduler { public void

Can create culture for en-EN on local dev machine

旧街凉风 提交于 2019-12-02 12:00:14
问题 I just deployed our application to our azure staging environment and ran into an issue with the en-EN culture not being supported. After some digging I find out that there is no such culture, and I should use en-GB or en-US instead. But, now to my question. On my local development machine I've got no problems creating a CultureInfo with en-EN . CultureInfo ci = new CultureInfo("en-EN"); Console.WriteLine("culture: "+ ci.ThreeLetterISOLanguageName); Outputs culture: eng I also tried

How to select .NET 4.5.2 as a target framework in Visual Studio

怎甘沉沦 提交于 2019-11-28 16:16:12
I have installed .NET Framework 4.5.2 on Windows 8.1. But in Visual Studio 2013 I do not see the .NET Framework 4.5.2 option (see screenshot). How do I target my project for .NET 4.5.2? You need to install the Microsoft .NET Framework 4.5.2 Developer Pack This contains the following components (emphasis added by me): .NET Framework 4.5.2 .NET Framework 4.5.2 Multi-Targeting Pack: Contains the reference assemblies needed to build apps that target the .NET Framework 4.5.2 .NET Framework 4.5.2 Language Packs .NET Framework 4.5.2 Multi-Targeting Pack Language Packs: Contains the IntelliSense files

Azure Websites, Can one deploy .NET 4.5.2 websites

微笑、不失礼 提交于 2019-11-28 12:00:44
From this SO post I see 4.5.1 is supported in WAWS and when you select 4.5, you are really running 4.5.1. How about the recently released 4.5.2 ? Is there any official documentation anywhere on which framework updates have been applied to WAWS? (changing the answer now that we have updated Azure Web Sites with .NET 4.5.2) .NET 4.5.2 is currently installed on Azure Web Sites. So you can deploy websites which take advantage of 4.5.2 framework features. I'm updating this answer to reflect this change. 来源: https://stackoverflow.com/questions/23554496/azure-websites-can-one-deploy-net-4-5-2

How to select .NET 4.5.2 as a target framework in Visual Studio

╄→гoц情女王★ 提交于 2019-11-27 09:38:38
问题 I have installed .NET Framework 4.5.2 on Windows 8.1. But in Visual Studio 2013 I do not see the .NET Framework 4.5.2 option (see screenshot). How do I target my project for .NET 4.5.2? 回答1: You need to install the Microsoft .NET Framework 4.5.2 Developer Pack This contains the following components (emphasis added by me): .NET Framework 4.5.2 .NET Framework 4.5.2 Multi-Targeting Pack: Contains the reference assemblies needed to build apps that target the .NET Framework 4.5.2 .NET Framework 4