.net-4.0

Repercussions of enabling useLegacyV2RuntimeActivationPolicy?

For my current project, we're using some CLR 2 based mixed mode assemblies. In order to use these from within a .NET 4 targetted assembly, I know you have to add useLegacyV2RuntimeActivationPolicy=true to the <startup> element within app.config. I understand that this changes the activation policy, causing these mixed-mode assemblies t...

First faltering step with Reactive Extensions

I'm struggling with my first simple "hello world" RX application. I'm using VS2010 RC, plus the latest RX download. The following is the simple console app; class Program { static void Main(string[] args) { var channel = new MessageChannel() .Where(m => m.process) .Su...

How can I generate Virtual Properties with the AssemblyBuilder in C# 4.0?

I'm currently working on creating an Assembly with virtual properties. The examples on MSDN are only creating normal properties. How do I create a class inside an assembly which has virtual properties? I would like to be able to generate a class like this: public class ClassA { public virtual int Id { get; set; } ...

Silverlight Dynamic Data

I wondered if anyone knows if Microsoft is planning to do a Dynamic Data framework for Silverlight like they’ve got for ASP.NET? Does a non Microsoft framework like this already exist? ...

Does Parallel.ForEach require AsParallel()

ParallelEnumerable has a static member AsParallel. If I have an IEnumerable<T> and want to use Parallel.ForEach does that imply that I should always be using AsParallel? e.g. Are both of these correct (everything else being equal)? without AsParallel: List<string> list = new List<string>(); Parallel.ForEach<string>(GetFileList().Where...

Getting a "ComponentActivatorException" using Castle Windsor from a .net 4.0 application using a .net 2.0 component.

I have an application which is being developed in VS2010, and makes use of the Castle-Windsor IoC, through a configuration file. One of the components I am registering, also developed in VS2010, references a .net 2.0 component (LeadTools), so recompiling the 2.0 project isn't an option. When the wrapping component's registration is done...

Log4Net and .NET 4.0 RC

I tried to compile a project dependent on the Log4Net logging framework using .NET 4.0 RC and ran into some problems. Out of the box (just changing the target to .NET 4.0), it no longer works, a security exception is thrown. Inheritance security rules violated while overriding member: 'log4net.Util.ReadOnlyPropertiesDictionary.GetObjec...

Entity Framework 4 + Self-Tracking Entities + ASP.NET Dynamic Data = Error

I'm using the Self-Tracking Entities codegen option in EF4 (VS2010 RC), and I'm trying to use Dynamic Data to build a quick-and-dirty website for editing. The Entities, Data Context, and EDMX files are all in separate assemblies, and this model works well when I call everything in code. But when I try to use it with Dynamic Data, right o...

Workflow Foundation .NET 4 learning resources

Can you recommend some resources (web or book) providing an introduction to Windows Workflow Foundation in .NET 4? Basic introduction is what I need at the moment but I would also very appreciate advanced-level materials. Thanks! ...

Setting useLegacyV2RuntimeActivationPolicy for test projects in VS 2010

In .NET 4, loading .NET 2 mixed-mode assemblies requires setting useLegacyV2RuntimeActivationPolicy="true" in the startup element of the app.config file for the application project. How can I set this (and is it necessary) for a test project? I am getting some very odd behavior in the testing host, but only for tests that use CLR 2 mix...

Entity Framework - C# or VB.Net

My company is tossing around the idea of using the Entity Framework when it comes out with .NET 4. We are currently a VB.NET shop, but have some interest in switching to C#. Is there any major arguments for or against such a move? Does EF with C# hold any advantages in performance, coding ease, etc over VB.NET? Thanks for your thought...

How (and if) to write a single-consumer queue using the task parallel library?

I've heard a bunch of podcasts recently about the TPL in .NET 4.0. Most of them describe background activities like downloading images or doing a computation, using tasks so that the work doesn't interfere with a GUI thread. Most of the code I work on has more of a multiple-producer / single-consumer flavor, where work items from multi...

How to read an .RTF file using .NET 4.0

I have seen samples using Word 9.0 object library. But I have Office 2010 Beta and .NET 4.0 in VS2010. Any tips on how to go with the new Word Dlls? So I just wanted to get the functionality of RTF to TEXT with .NET3.5 or later. ...

How to Force an Exception from a Task to be Observed in a Continuation Task?

I have a task to perform an HttpWebRequest using Task<WebResponse>.Factory.FromAsync(req.BeginGetRespone, req.EndGetResponse) which can obviously fail with a WebException. To the caller I want to return a Task<HttpResult> where HttpResult is a helper type to encapsulate the response (or not). In this case a 4xx or 5xx response is not...

Is there a library that can decompile a method into an Expression tree, with support for CLR 4.0?

Previous questions have asked if it is possible to turn compiled delegates into expression trees, for example: http://stackoverflow.com/questions/767733/converting-a-net-funct-to-a-net-expressionfunct The sane answers at the time were: It's possible, but very hard and there's no standard library solution. Use Reflector! But fortu...

Co- and Contravariance bugs in .NET 4.0

Some strange behavior with the C# 4.0 co- and contravariance support: using System; class Program { static void Foo(object x) { } static void Main() { Action<string> action = _ => { }; // C# 3.5 supports static co- and contravariant method groups // conversions to delegates types, so this is perfectly legal: action...

EF4 POCO (not using T4): Mapping and metadata information could not be found for EntityType...

I have a pretty simple console project with an entity model (containing two simple entities), two handmade POCOs and a handmade Context class. The program fires a simple query against the DB and everything including LazyLoading works fine. The problem: As soon as i add another Entity data model (even if i add an empty one), the calls t...

How to Upgrade Existing ASP.NET 1.1 Custom CMS to ASP.NET 4.0?

Here's what I have: Custom-made C# CMS where the content is stored in a database in XML, and XSLT is applied to format the page content. Here's my task: Design new front-end site and upgrade to ASP.NET 4.0 (via ASP.NET 2.0 first) in the process. Accessibility and standards compliance are factors. Here's my problem: Comprehensi...

Which shortcomings of Entity Framework have been addressed in .Net 4.0?

I'm committed to EF as I'm currently using it in a project but I also find it a major pain and learning curve as there are some things it does not do well that I would expect it to. Does anyone know if the following issues are any easier in EF 4.0? Foreign key access, sometimes you want the foreign key from a table rather than an enti...

Can i use .net framework 4 with visual studio 2008 IDE

Possible Duplicate: Can I use .NET 4.0 beta in Visual Studio 2008? Hot can I use visual studio 2008 IDE with .net framework 4? ...