.net-4.0

Does anybody know of good resources for parallel programming patterns/testing using .NET 4.0 tasks?

Hi, I recently asked a developer to write a library using the new multithreading capabilities of .NET 4.0. He's done a great job, but I'm concerned that the Task logic is repeated throughout the code and not nicely encapsulated. I'm also concerned that this creates a problem when it comes to testing. Normally, I test by creating a se...

The new BigInteger

.NET 4.0 now has a new data type, System.Numeric.BigInteger. From what I understand, this can hold numbers that have, up to, 1 million digits. Simple arithmetic operations can be performed on this number. What I am wondering is how Microsoft implemented such a thing, given that it would obviously exceed 32-bits and even 64-bits. How does...

Method throwing me out of parent method

I'm adding a User (custom class) through my Repository by hijacking the generic Add(T item) method and throwing it to a private AddUser method, if item == typeof(User). It does just that, but as soon as it hits the FlushMembership() call, it exits out too early, ie. it doesn't hit anything beyond that FlushMembership() call and thus no U...

How ISubject and Subject will look like in this sample and are the sample using them in the right place?

I got this sample http://jfromaniello.blogspot.com/2010/04/event-aggregator-with-reactive.html, Which describe event aggregator pattern using .net 4.0 but i didn't find in the sample code the ISubject interface and the Subject class and i found the he is using them in the EventAggregator class, is it right to use them like that and wh...

Serializing Dictionary<string, object> when dictionary was initialized with case insensitive string comparer

I am serializing a Dictionary to XML. When I create a new dictionary I use the constructor to provide EqualityComparer without casing for instance var tabs = new Dictionary<string,Tab>(StringComparer.OrdinalIgnoreCase); I then serialize to XML and when I deserialize information about casing is lost - the deserialization is made to the...

Is it possible to adjust AppFabric Cache server to store larger objects?

I'm getting an error with the AppFabric Cache Server when I presume a larger object graph gets added to the cache. ErrorCode :SubStatus:The connection was terminated, possibly due to server or network problems or serialized Object size is greater than MaxBufferSize on server. Result of the request is unknown. I know for sure its not a...

WCF online learning resources

So I've done a little WCF in the most basic way I could come up with and even then found myself wrestling in the config a little before getting it to work. I love the simplicity of contract definition and implementation though once you get the config wrapped. Given that could someone point me to some good online resources (not books, no...

Unit testing examples for VS2010 testing tools

I'm looking for sample solution(s) that demonstrate various kinds of unit tests in C# using best practices. Also I require the examples to use the Visual Studio test tools. I know that there are a number of books and web sources on unit testing, but they don’t use the Visual Studio tools for writing their unit tests. I don’t want really...

WPF fails to resize a controle

I've already scoured my XAML file for the word "Width" and it only appears with a number as a value at the root element, setting the width of the entire control. The word "height" only has a numerical value at the root element and two textboxes that aren't in the same Grid cell as the checkbox below. Unfortunately, regardless of the val...

How to load .net3.5 "DropShadowEffect" on .net3.0&4.0 system while targeting 3.0?

Hello, I am using the System.Windows.Media.Effects.DropShadowEffect that has been available since .net 3.0 sp2 and .net 3.5 sp1. Now I'm getting errors from systems that have only .net 3.0 and .net 4.0 - they get: TypeLoadExcpeption Could not load type 'System.Windows.Media.Effects.DropShadowEffect' from assembly 'PresentationCore, V...

Whats the difference between <RequiredTargetFramework> and <targetframeworkversion>?

We upgraded our .net 3.5 projects (c#) to .net 4.0. When you look at the project file there are two tags that I'm trying to make sense out of: <RequiredTargetFramework>3.5</RequiredTargetFramework> <TargetFrameworkVersion>4.0</TargetFrameworkVersion> Why are there two seemingly similar tags with different values? ...

Configuration-Based Activation Problem In My Wcf Service

Hi, I want to use new .Net framework 4.0 feature "Configuration-Based Activation". I wrote that lines into web.config. <system.serviceModel> <serviceHostingEnvironment> <serviceActivations> <add factory="MyCompany.Core.Hosting.WcfHostFactory" relativeAddress="Greeting.svc" service="MyCompany.Core.Services.Gree...

How to get notification that a System.Threading.Tasks.Task has completed

I am currently replacing some home baked task functionality with a new implementation using the new System.Threading.Tasks functionality found in .net 4. I have a slight issue though, and although I can think of some solutions I would like some advice on which is generally the best way to do it, and if I am missing a trick somewhere. W...

How can I find my contract method from a WCF message header Action?

I have created a class that implements IDispatchMessageInspector and in the AfterReceiveRequest method I can get the action in this form: "http://example.com/contract_name/operation_name" Is there a good way that I can get figure out what method that is in my contract interface? Can I do it using the same code that WCF uses to find what...

Manually setting the Value of Lazy<T>

I have an object which I create from the response from a webservice. If I get a list of these objects, they have a minimal amount of information (in the example below, ID, Prop1 and Prop2 are returned in the list response). If I get the object by ID, the full set of information is returned, including the child objects in Prop3 and Prop4....

Difference between dynamic and System.Object

What is the difference between a variable declared as dynamic and a variable declared as System.Object? Running the following function would seem to indicate that both variables get cast to the correct type dynamically: void ObjectTest() { System.Object MyTestVar = "test"; dynamic MyTestVar2 = "Testing 123"; Console.WriteLi...

Using Command Text in EntityDataSource control

Hi, In my case I have to fetch data from two table so, inspite of using a select property.. I am using command Text..but on running it throws error: 'dbo.InvestorSectors' could not be resolved in the current scope or context. Make sure that all referenced variables are in scope, that required schemas are loaded, and that namespaces are...

ASP.net MVC Project doesn't appear in project templates

Hi guys. My SO is Windows server 2003, and i have already installed on my machine .net 4 and MVC 2. But when i open vs2008 i don't see MVC web projects, strange in my pc at home appears perfectly but here in the work nothing. Someone knows how to resolve? Thanks ...

Using System.Windows.DragDrop.DoDragDrop() with touch events?

Hi there, I currently develop an application providing the possibility to drag&drop items from one ListBox to an other. This is working perfectly while using a mouse. However, when trying to do the same with a touch screen (producing genuine touch events) this will not work. In my logs I see that the TouchDown and Move is actually det...

WCF 4 Rest Service on IIS Developer Express, Authentication Issue.

When I host the "WCF 4 Rest Service Template" project (from template) in IIS Developer Express I get the following: IIS specified authentication schemes 'IntegratedWindowsAuthentication, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM,...