.net-4.5

How many threads Parallel.For(Foreach) will create? Default MaxDegreeOfParallelism?

三世轮回 提交于 2020-01-19 05:40:29
问题 I want to know, how many threads will be used when I run Parallel.For/ForEach loop. I found, that it can be changed by MaxDegreeOfParallelism option. MaxDegreeOfParallelism help on MSDN says (link): By default, For and ForEach will utilize however many threads the underlying scheduler provides, so changing MaxDegreeOfParallelism from the default only limits how many concurrent tasks will be used. But I don't know how many threads underlying scheduler provides. How can I find out that? I could

Thread.Sleep vs Task.Delay?

非 Y 不嫁゛ 提交于 2020-01-19 03:09:25
问题 I know that Thread.Sleep blocks a thread. But does Task.Delay also block? Or is it just like Timer which uses one thread for all callbacks (when not overlapping)? (this question doesn't cover the differences) 回答1: The documentation on MSDN is disappointing, but decompiling Task.Delay using Reflector gives more information: public static Task Delay(int millisecondsDelay, CancellationToken cancellationToken) { if (millisecondsDelay < -1) { throw new ArgumentOutOfRangeException(

Thread.Sleep vs Task.Delay?

喜你入骨 提交于 2020-01-19 03:09:17
问题 I know that Thread.Sleep blocks a thread. But does Task.Delay also block? Or is it just like Timer which uses one thread for all callbacks (when not overlapping)? (this question doesn't cover the differences) 回答1: The documentation on MSDN is disappointing, but decompiling Task.Delay using Reflector gives more information: public static Task Delay(int millisecondsDelay, CancellationToken cancellationToken) { if (millisecondsDelay < -1) { throw new ArgumentOutOfRangeException(

Retargeting solution from .Net 4.0 to 4.5 - how to retarget the NuGet packages?

痞子三分冷 提交于 2020-01-18 11:08:14
问题 I have migrated a solution that is currently targeting .NET 4.0 in VS2010 to VS2012 and now I would like to re-target it to .Net 4.5 What I am not sure about is the NuGet packages. For example EF5, which I updated from EF4 in VS2010 turns out to be actually EF 4.4 as you can see here: <Reference Include="EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\packages\EntityFramework

What is the .NET System.Numerics.BigInteger Equivalent of Org.BouncyCastle.Math.BigInteger.ToByteArrayUnsigned?

本秂侑毒 提交于 2020-01-16 08:13:11
问题 I am currently working with the .NET port of BouncyCastle and I am having some trouble converting a big integer into a System.Guid using the native .NET BigInteger . For some context, I am using BouncyCastle in one ("source") application to convert a System.Guid to a Org.BouncyCastle.Math.BigInteger . This value is then saved as a string in the format 3A2B847A960F0E4A8D49BD62DDB6EB38 . Then, in another ("destination") application, I am taking this saved string value of a BigInteger and am

Should I use async await on UI Thread or Task.Run to process multiple files?

老子叫甜甜 提交于 2020-01-16 01:09:32
问题 I am writing an application in WPF using .NET 4.5. The application allows the user to select multiple files and import them. When this happens the application will parse text files and store the data into a database. The files can be very large so I want the UI to remain responsive and allow the user to do other things while this is happening. I'm new to asynchronous programming and would to know what the best approach would be? According to a Microsoft article... "The async and await

Migrating C++CLI wrapper from .NET 4.0 to 4.5 cause winsock error on Windows Server 2012 R2

喜你入骨 提交于 2020-01-15 23:55:47
问题 I have build a C++ CLI wrapper for a communication middleware we use. The wrapper has been in .NET 4.5 and works fine in Windows 7 and Windows Server 2008 R2. But in Windows Server 2012 R2 it crashes with an "Access violation" error in mswsock.dll The interesting part is that if I build the wrapper and test application to target .NET 4.0 it works. But when I re-target them to .NET 4.5.x it triggers the exception. I've tried to investigate security, strong naming, hot-fix'ing .NET, but to no

Large number of dead threads in .Net memory dump

霸气de小男生 提交于 2020-01-15 14:21:07
问题 during the analysis of a memory dump for a .Net4.5 WCF w3wp process, I encountered many threads identified as dead. !threads shows 68 out of 107 threads are dead which appear to be quite high. I was wondering if these threads could hold large amount of memory since the process eventually goes as high as 20GB+ and seem to never go down. How can I inspect such threads and see the objects/memory held by these? Is it normal to have so many? 0:000> !threads ThreadCount: 107 UnstartedThread: 0

Large number of dead threads in .Net memory dump

三世轮回 提交于 2020-01-15 14:19:08
问题 during the analysis of a memory dump for a .Net4.5 WCF w3wp process, I encountered many threads identified as dead. !threads shows 68 out of 107 threads are dead which appear to be quite high. I was wondering if these threads could hold large amount of memory since the process eventually goes as high as 20GB+ and seem to never go down. How can I inspect such threads and see the objects/memory held by these? Is it normal to have so many? 0:000> !threads ThreadCount: 107 UnstartedThread: 0

Large number of dead threads in .Net memory dump

不羁的心 提交于 2020-01-15 14:19:08
问题 during the analysis of a memory dump for a .Net4.5 WCF w3wp process, I encountered many threads identified as dead. !threads shows 68 out of 107 threads are dead which appear to be quite high. I was wondering if these threads could hold large amount of memory since the process eventually goes as high as 20GB+ and seem to never go down. How can I inspect such threads and see the objects/memory held by these? Is it normal to have so many? 0:000> !threads ThreadCount: 107 UnstartedThread: 0