.net-4.0

Differences in the different ways to make concurrent programs

Hi, What is the difference between: Starting a new thread Using TPL Using BackgroundWorker All of these create concurrency but what are the low-level differences between these? Do all 3 make threads anyway? Thanks ...

Practical example where Tuple can be used in .Net 4.0?

I have seen the Tuple introduced in .Net 4 but I am not able to imagine where can be it be used. We can always make a Custom class or Struct. Edit: I am looking for an example which can also be considered inside the bracket of best practices. ...

SGEN doesn't work after upgrading from VS2008 to VS2010

I just recently upgraded a VS2008/.NET 3.5 SP1 project to VS2010 and .NET 4. I have a post-build event which calls SGEN to generate the XmlSerializers assembly. Whenever I try to run it I get the following error. "C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\sgen.exe" /debug /force /verbose /c:"platform:x86" "C:\path\to\SomeAssemb...

Under what circumstances would a LINQ-to-SQL Entity "lose" a changed field?

I'm going nuts over what should be a very simple situation. In an ASP.NET MVC 2 app (not that I think this matters), I have an edit action which takes a very small entity and makes a few changes. The key portion (outside of error handling/security) looks like this: Todo t = Repository.GetTodoByID(todoID); UpdateModel(t); Repository.Sav...

Default for generic type?

Is it possible to do something like public class PriorityQueue<TValue, TPriority=int> where TPriority : IComparable (note the =int) ? Before you suggest it, yes, I know I can just add another line: public class PriorityQueue<TValue> : PriorityQueue<TValue, int> { } But I'm wondering if it's possible to do it as a param. ...

Setup program needs framework 4.0 - But it's already installed

Hi all, I created a service which I now want to install to test. When running the setup program it prompts me to download and install .net fw 4.0, but I already have it installed. I did try to just install the file that I get pointed to (4.0 cliet), but not only does it still not work, it causes vs2010 to throw an unknown error and can'...

Setup requires .NET 4.0 - System already has .net 4.0

I created a service which I now want to install to test, I created a setup program from the templates in Visual Studio 2010. When running the setup program it prompts me to download and install .NET 4.0, but I already have it installed. I did try to just install the file that I get pointed to (4.0 client), but not only does it still not ...

Parallel For Loop - Problems when adding to a List

I am having some issues involving Parallel for loops and adding to a List. The problem is, the same code may generate different output at different times. I have set up some test code below. In this code, I create a List of 10,000 int values. 1/10th of the values will be 0, 1/10th of the values will be 1, all the way up to 1/10th of the ...

Does a .NET 4.0 website load faster for a reason?

I have been using DotNetBlogEngine for many years, and today my host (JodoHost.com) officially turned on support for .NET 4.0. I had them change my site from a 2.0 application to a 4.0 application and planned on recompiling the site if I had to. What I've noticed immediately is that the website loads tremendously faster on the first loa...

Code Contracts Vs. Object Initializers (.net 4.0)

At face value, it would seem that object initializers present a problem for .net 4.0 "code contracts", where normally the invariant should be established by the time the object constructor is finished. Presumably, however, object-initializers require properties to be set after construction is complete. My question is if the invariants ...

How does Task Parallel Library scale on a terminal server or in a web application?

I understand that the TPL uses work-stealing queues for its tasks when I execute things like Parallel.For and similar constructs. If I understand this correctly, the construct will spin up a number of tasks, where each will start processing items. If one of the tasks complete their allotted items, it will start stealing items from the o...

WPF not applying default styles defined in MergedDictionaries?

In a WPF application I defined default control styles in separate resource dictionaries (e.g. "ButtonStyle.xaml"), and added them as merged dictionaries to a resource dictionary named "ResDictionary.xaml". If I refer this "ResDictionary.xaml" as merged dictionary in my App.xaml, the default styles are not applied. However, if I refer th...

How are .NET 4 GUIDs generated?

I am aware of the multitude of questions here as well as Raymond's excellent (as usual) post. However, since the algorithm to create GUIDs was changed apparently, I found it hard to get my hands on any up-to-date information. The MSDN seems to try and provide as few information as possible. What is known about how GUIDs are generated in...

What is .Net Framework 4 extended?

For testing purposes, I installed .Net Framework 4 Client Profile. My tests ended and I was to uninstall it, in order to install .Net Framework 4 full. The uninstaller told me to uninstall .Net Framework 4 extended first. I've already found it and uninstalled, but the question remains: What is .Net Framework 4 extended? ...

ConcurrentDictionary updates and enumeration thread sync.

I have 1.N threads writing to a .net 4.0 ConcurrentDictionary. I have another thread which fires every 5 seconds (settable in app.config) to enumerate the dictionary, and potentially remove some items. I want to halt the write operations during the enumeration. What would be the best primitive to synchronize these two operations. Any he...

Where I can download the REAL Full .Net Framework 4 Standalone Installer?

I found that links: Microsoft .NET Framework 4 (Web Installer) Microsoft .NET Framework 4 (Standalone Installer) Microsoft .NET Framework 4 Client Profile (Standalone Installer) Note that (2) the size is 48.0 MB and the (3) the size is 41.0 MB. It's not the REAL .Net 4 Full Standalone. :( I want that installer in a usb pen drive bec...

Difference between .Net4 Client Profile and Full Framework download

The .Net 4 32 + 64 bit Full is 48.1 MB and the Client Profile is 41.0 MB. Why I will prefer install the Client Profile instead of the "Full Framework"? What difference there is in that packages? ...

ASP.Net 4.0 - Response required in SiteMap building?

I'm running into an issue upgrading a project to .Net 4.0...and having trouble finding any reason for the issue (or at least, the change causing it). Given the freshness of 4.0, not a lot of blogs out there for issues yet, so I'm hoping someone here has an idea. Preface: this is a Web Forms application, coming from 3.5 SP1 to 4.0. In ...

Making a call to a .NET 4 library from 3.5

Hi, I have the need to make a call to the System.Xaml library in .NET 4.0. Is it possible to make a call to this library if your project is targeted to 3.5? ...

Visual Studio 2010 and TFS 2008: Building unit test projects

Hi, We are currently taking VS2010 for a testdrive and so far we are a little stumped with how it just won't cooperate with our existing Team Foundation Server 2008. We still have all our projects on .NET 3.5 and whenever we are now building a solution that contains a unit test project (which automatically builds in .NET 4.0) the TFS wo...