.net-4.6

Visual Studio 2015 InvalidProgramException in Unit Test With Fakes

半腔热情 提交于 2019-12-03 23:15:44
问题 I am using Visual Studio 2015 Enterprise RTM to write unit tests for a project that uses Unity Container. I have discovered that the simple act of adding a fakes assembly for Unity, not even actually using the fake, is sufficient to generate this exception: System.InvalidProgramException: Common Language Runtime detected an invalid program. Consider the following steps to reproduce: Using Visual Studio 2015 Enterprise RTM create a Unit Test project targeting .NET 4.6 Add the NuGet package

Visual Studio 2015 - Shared Projects Reference Tab Missing on Web Project

两盒软妹~` 提交于 2019-12-03 06:49:55
问题 I upgraded to Visual Studio 2015 from our MSDN subscription because I was pretty excited to read about Shared Projects... No more managing 21382 nuget packages in our dependencies when all we want to do is reuse code. So I built a test shared project with some code in it. Then I add a new empty web application on .Net 4.6 to the project. Now I expected to go to references and see a "Shared Projects" tab on the references window, but I do not see one. Now I can add a class library to the same

TaskContinuationOptions.RunContinuationsAsynchronously and Stack Dives

佐手、 提交于 2019-12-03 04:18:41
问题 In this blog post, Stephan Toub describes a new feature that will be included in .NET 4.6 which adds another value to the TaskCreationOptions and TaskContinuationOptions enums called RunContinuationsAsynchronously . He explains: "I talked about a ramification of calling {Try}Set* methods on TaskCompletionSource, that any synchronous continuations off of the TaskCompletionSource’s Task could run synchronously as part of the call. If we were to invoke SetResult here while holding the lock, then

RyuJit producing incorrect results

萝らか妹 提交于 2019-12-03 01:02:38
After recently upgrading to .net 4.6 we discovered a bug where RyuJit produces incorrect results, we were able to work around the issue for now by adding useLegacyJit enabled="true" to the app.config. How can I debug the machine code generated by the following? I created a new console project in VS 2015 RTM, set to Release, Any CPU, unchecked Prefer 32 bit, running with and without debugger attached produces the same result. using System; using System.Runtime.CompilerServices; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { Console.WriteLine(Calculate());

Visual Studio 2015 - Shared Projects Reference Tab Missing on Web Project

对着背影说爱祢 提交于 2019-12-02 21:19:23
I upgraded to Visual Studio 2015 from our MSDN subscription because I was pretty excited to read about Shared Projects... No more managing 21382 nuget packages in our dependencies when all we want to do is reuse code. So I built a test shared project with some code in it. Then I add a new empty web application on .Net 4.6 to the project. Now I expected to go to references and see a "Shared Projects" tab on the references window, but I do not see one. Now I can add a class library to the same solution and I see the tab and can add the shared reference. However I cannot add the shared project to

Cannot set app to use system default TLS version by adding appcontext settings in web.config

早过忘川 提交于 2019-12-01 23:27:27
According to .net guidance of TLS protocol programming , it suggests to config security via appcontext switch when your project targets on .net 4.6. This way works when add appcontext in app.config for console application. However, it doesn't work when add appconext switch in web.config for website project. This is the config I add. <runtime> <AppContextSwitchOverrides value="Switch.System.Net.DontEnableSchUseStrongCrypto=false;Switch.System.Net.DontEnableSystemDefaultTlsVersions=false"/> </runtime> AppContext switches usage in web config file: <appSettings> <add key="AppContext.SetSwitch

ASP.NET Middleware doesn't preserve culture anymore

风流意气都作罢 提交于 2019-12-01 16:40:12
问题 Given asp.net 4 with mvc 5.2.3 and .net 4.6.1 I want to change the CurrentCulture support globalization based on some request related things like the host. A Owin-Middleware which sets a culture. Simplified Version which produces the behavior: public override async Task Invoke(IOwinContext context) { var culture = new CultureInfo("es-ES"); Thread.CurrentThread.CurrentCulture = culture; Thread.CurrentThread.CurrentUICulture = culture; CultureInfo.CurrentCulture = culture; CultureInfo

Visual Studio 2015 InvalidProgramException in Unit Test With Fakes

大憨熊 提交于 2019-12-01 02:07:12
I am using Visual Studio 2015 Enterprise RTM to write unit tests for a project that uses Unity Container . I have discovered that the simple act of adding a fakes assembly for Unity, not even actually using the fake, is sufficient to generate this exception: System.InvalidProgramException: Common Language Runtime detected an invalid program. Consider the following steps to reproduce: Using Visual Studio 2015 Enterprise RTM create a Unit Test project targeting .NET 4.6 Add the NuGet package "Unity" version 3.5.1404.0 Add the NuGet package "CommonServiceLocator" version 1.2.0 Write a single unit

OwinMiddleware doesn't preserve culture change in .net 4.6.*

左心房为你撑大大i 提交于 2019-11-30 17:48:12
问题 I have an owin culture middle ware running very nice. It just changes the culture according to the url. This works in 4.5.* perfectly. Now when the runtiome is changed to 4.6.1, the culture isn't preserved anymore and as a result it just doesn't work. I can reproduce it in a very simple solution which only has this middleware simulating the culture change public class CultureMiddleware : OwinMiddleware { public CultureMiddleware(OwinMiddleware next) : base(next) { } public override async Task

Always use the 'async' and 'await' keywords in asynchronous methods in a library?

ぃ、小莉子 提交于 2019-11-30 08:35:36
Summary : In a library method, when should I use the async and await keywords instead of returning a Task directly? I believe my question is related to this one . However, that question is about .NET 4.0 and the TPL, while I'm using .NET 4.6 with the async and await keywords. So, I think my question might get different answers because these keywords didn't exist when the linked question was answered. Explanation: I'm writing a simple wrapper for an external WCF service and the wrapper makes multiple SendAsync calls. Now I think that each wrapper method should just return a Task<> directly