.net-4.0

Can I use .NET 4 Code Contracts and remain compatible with .NET 3.5?

.NET 4 introduced Code Contracts as a new feature. I'd like to use CC, but provide files that can still run in 3.5 SP1. Is that possible? Can I only use parts of the new functionality? Apparently it is possible to have CC only do static checks without being included in the binary files, is that correct? I'm aware CC was available for 3....

Will .NET framework 4 change exam 70-536?

Hi, Anyone have any information (including website links) on the syllabus changes (if any) for this exam for .NET 4? I basically want to know if there will be change in the material covered. Update to question: After Steven's excellent observation, let me ask it this way: What will the syllabus of the application foundation exam for...

Exception calling UpdateModel - Value cannot be null or empty

This is probably something silly I'm missing but I'm definitely lost. I'm using .NET 4 RC and VS 2010. This is also my first attempt to use UpdateModel in .NET 4, but every time I call it, I get an exception saying Value cannont be null or empty. I've got a simple ViewModel called LogOnModel: [MetadataType(typeof(LogOnModelMD))] public ...

Is there a literal notation for decimal in IronPython?

suppose I have the following IronPython script: def Calculate(input): return input * 1.21 When called from C# with a decimal, this function returns a double: var python = Python.CreateRuntime(); dynamic engine = python.UseFile("mypythonscript.py") decimal input = 100m; // input is of type Decimal // next line throws RuntimeBinde...

Adding Custom Filters for Dynamic Data Website (VS2010, EF4)

Trying to add some different filters (in addition to the ForeignKey filter) to a Dynamic Data Website in VS2010 using EF4. I can add the new Filter templates, but how do I specify which template will get displayed for each property in my model? Thanks ...

Error Running MVC2 application in IIS on .NET 4.0

I recently installed the RTM version of 4.0. I now receive an error when running MVC2 websites in a .net 4 app pool. The error is "User is not available in this context." All works fine on .net 2.0 app pools or if I run the app within the VS10 web server. The error only occurs in IIS on .net 4.0. To verify that it was not something speci...

C# .NET 4.0 and Generics

I was wondering if anyone could tell me if this kind of behaviour is possible in C# 4.0 I have an object hierarchy I'd like to keep strongly typed. Something like this class ItemBase {} class ItemType<T> where T : ItemBase { T Base { get; set; } } class EquipmentBase : ItemBase {} class EquipmentType : ItemType<EquipmentBase> {}...

Which way is preferred when doing asynchronous WCF calls?

When invoking a WCF service asynchronous there seems to be two ways it can be done. 1. WcfClient _client = new WcfClient(); public void One() { _client.BegindoSearch("input", ResultOne, null); } private void ResultOne(IAsyncResult ar) { string data = _client.EnddoSearch(ar); } 2. public void Two() { WcfClient client...

Why is PLINQ slower than LINQ for this code?

First off, I am running this on a dual core 2.66Ghz processor machine. I am not sure if I have the .AsParallel() call in the correct spot. I tried it directly on the range variable too and that was still slower. I don't understand why... Here are my results: Process non-parallel 1000 took 146 milliseconds Process parallel 1000 took 15...

WCF .Net 4.0 is treating WebProtocolException as an unhandled exception

Im trying to build an API using WCF and .Net 4, however when I throw the WebProtocolException, it is not displaying a nice error message like it should, instead it is treating it like an unhandled exception. I am using the WebServiceHost2Factory. Has anyone else used WebProtocolException with .net 4? An example of my call is below th...

It is okay to migrate to Asp.NET 4.0 now?

Okay today, as most of you noticed Framework 4.0 has been released. I've been working on a project which is being built on framework 3.5. Since I want to use dynamic keyword and most of the asp.net features like Tableless Menu Control, ClientIDMode and clean web.config etc. I am kinda urging to migrate the unfinished project to 4.0 but I...

Visual Studio 2010 ADO.NET Data Model vs Linq to SQL

What's the difference between the two? They seem to have the same functionality at first glance. Which one has faster performance which one is easier to use? ...

Best way to unit-test WCF REST/SOAP service while dynamically generating stubs

I have a webservice written with WCF 4.0 that exposes REST and SOAP functions, and I want to set up my unit tests so that as I work on my web services I can quickly test by having the test framework start up the service, outside of IIS, and then do the tests. I want it to be dynamically generated as I am not certain what the interface w...

Will we be able to use vs2008 with .NET framework 4.0 final release?

I know the answer for the beta was no (http://stackoverflow.com/questions/998090/can-i-use-net-4-0-beta-in-visual-studio-2008) but I was wondering if with the final release it would be different? Thanks Leo ...

Will Visual Studio 2010 only run 4.0 unit tests?

I have different projects written in .NET 3.5 and some unit test projects to cover them. When converting my solution to be used in Visual Studio 2010 I keep all my projects in 3.5 but the unit tests are forced to 4.0? This way I cannot use them with my regular projects anymore. Resulting in this: Could not load file or assembly 'xxx.xxx...

Why do C# automatic properties not support default values like VB 2010?

Looking at the new VB 2010 features, I stumbled upon support for Auto-Implemented Properties. Since I'm working with C#, this seemed quite familiar, but I noticed that VB did add a feature I would love to have in C#: setting a arbitrary default value for the auto-implemented property: I really like the clean usage of auto-properties...

Loading/Executing CLR 2.0 assemblies in CLR 4.0

Can the CLR 4.0 execute CLR 2.0 IL without the need for source code recompilation? ...

Problem with Gallio and TeamCity and the new Visual Studio 2010 release

I am running TeamCity on a virtual machine. I have installed the new Visual Studio 2010 release yesterday and converted my VS 2008 projects. I also have installed .NET Framework 4 on my virtual machine. Before yesterday all my projects were building succesfully on the CI server but since I installed VS 2010 I get the following error me...

.NET /asp.net 4: Changes with automatic NAMES of controls?

Hi there, I just updated an app from .net 2.0 to .net 4.0 and i have noticed the following... For example i have the following control.. <input type="hidden" name="ctl00$cphMain$hfdFueraHorarioOficinaConfirmado" id="cphMain_hfdFueraHorarioOficinaConfirmado" value="False" /> and then in javascript i did this before.. var hf...

Will .NET 4.0 apps work on Win 2008 R2 Server Core?

When Windows Server 2008 R2 was launched, the "server core" edition started to become useful to me, because it lets me deploy .NET background applications isolated on their own virtual machine instance with only a small fraction of all the disk space overhead of a default Windows Server installation, and very few Windows Updates. It come...