.net-4.0

Help with debugging an object not arriving at WCF/Workflow in .net 4.0 beta 1

I'm using VS 2010 and .net 4.0 beta 1 to do some workflow using WCF. I've created a XAMLX WCF/WF service to receive and process an instance of a class. The class is just a DTO marked with DataContract/DataMember attributes. I've tested it with the WcfTestClient and it works. So, now I've created another WCF/WF workflow to consume t...

Support of progress reporting and incremental results in .NET 4.0 "Task Parallel Library"

I know that Task Parallel Library is still in Beta and there are likely to be less resources available but from whatever I have read, library gives very special treatment to task scheduling, exception handling and cancellation. But I don't find any references to progress reporting and sending incremental results from tasks. These 2 thin...

PerformanceCounters on .NET 4.0 & Windows 7

I have a program that works fine on VS2008 and Vista, but I'm trying it on Windows 7 and VS2010 / .NET Framework 4.0 and it's not working. Ultimately the problem is that System.Diagnostics.PerformanceCounterCategory.GetCategories() (and other PerformanceCounterCategory methods) is not working. I'm getting a System.InvalidOperationExcepti...

Is there a way to tell which Tasks are currently running in Task Parallel Library

I can't see a way to see which tasks are running. There is the Task.Current property, but what if there are multiple tasks running? Is there a way to get this kind of information? Alternately, is there a built in way to get notified when a task starts or completes? ...

MemoryMappedFile.CreateFromFile always throws UnauthorizedAccessException

I realize .NET 4.0 is in Beta, but I'm hoping someone has a resolution for this. I'm trying to create a memory mapped file from a DLL: FileStream file = File.OpenRead("C:\mydll.dll"); using (MemoryMappedFile mappedFile = MemoryMappedFile.CreateFromFile(file, "PEIMAGE", 1024 * 1024, MemoryMappedFileAccess.ReadExecute)) { using (M...

Abusing .NET 4.0 Interface Code Contracts feature to achieve MixIns functionality

.NET 4.0 has that new Code Contracts feature. It works with interfaces too, as described here (scroll down to somewhere in the comments): http://weblogs.asp.net/podwysocki/archive/2008/11/08/code-contracts-for-net-4-0-spec-comes-alive.aspx Now my question is, can we use and abuse this "Default Interface Implementation Feature" by putti...

How do I test for typeof(dynamic)?

I've got a generic method TResult Foo<TSource, TResult>(IEnumerable<TSource> source) and if TResult is declared as dynamic I want to execute a different code path than for other type declarations. For regular types you can do stuff like: if (typeof(TResult) == typeof(int)) return ExpressionFactory.CreateExpandoFunction<TSource, TRe...

AJAX change in .NET 4: Sys.Services.AuthenticationService

I'm testing my existing apps in VS 2010, and ran into my first break. ASP.NET AJAX authentication support has changed. Sys.Services.AuthenticationService.set_defaultLogoutCompletedCallback(OnLogoutCompleted); This no longer works. "Sys" is defined, but "Sys.Services" is an undefined object. Does anyone have a quick pointer to the repl...

ASP.NET MVC vs. ASP.NET 4.0

I watched this webcast recently, and I got the sense that a lot of the "cool stuff" from ASP.NET MVC is getting pulled back into the ASP.NET framework. At the moment I'm setting the ground-work for a project at my company using ASP.NET MVC, but after watching this, I'm beginning to wonder if that's the right choice, and whether it would...

What does 'useLegacyV2RuntimeActivationPolicy' do in the .NET 4 config?

While converting a project that used SlimDX, and therefore has unmanaged code, to .NET 4.0 I ran into the following error: Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information. Googling around gave me the solution, which is to a...

LINQPad for .NET 4.0

Using LINQPad, I am trying to test a few snippets with my own C# objects, which are written in .NET 4.0 (Beta 1) using VS2010 B1. When I try to use it, I get the following message in LINQPad: BadImageFormatException: Could not load file or assembly 'file:///C:...\XX.dll' or one of its dependencies. This assembly is built by a runtime ne...

How to reference .NET 4.0 assembly within .NET 3.5 projects

I would like to do some Office Interop stuff using .NET 4.0, but developing the rest of my projekt using VS2008 and .NET3.5. How can I now use the functionality from the .NET 4.0 assembly within my other solution. Loading CLR 4.0 assemblies into a 2.0 AppDomain won't work, does it? ...

Is it 'acceptable' to release .NET 4 based software yet (Nov 2009)?

Hi, I'm writing a small free tool. It's currently in Beta testing using .NET 3.5 but there's at least one aspect from .NET 4 I'd like to incorporate. So, is it jumping the gun a bit to release .NET 4 based software? Thx! ...

Anyone successfully installed .net framework 4.0 Beta2 on Windows 7 (64 bit)?

Hi, I've just installed windows 7 (64 bit) and sql server 2008 with sp1. Everything seemed fine until now. I've now downloaded .net Framework 4 beta 2 and am trying to run the installer and i get "unable to create new files in the folder into which files are being extracted." Can any one tell me what i'm missing? Has anyone been success...

IObservable<T> in .NET Framework 4.0 Beta2

IObservable<T> and IObserver<T> interfaces are placed directly in the System namespace in .NET Framework 4.0 Beta2. Why not in System.Collections.Generic, like IEnumerable<T>? p.s. Reactive Framework preview from Silverlight Toolkit contains IObserver<T> in the System.Collections.Generic namespace. ...

Docking in wpf .net 4.0

Hi there, is there a built in possibility in .net 4.0 to dock a WPF window into a container?? Something like in Visual Studio would be great. thanks! ...

Windows Workflow 4.0 Activities not being added to the toolbox

I've created a class project in VS 2010 Beta 2. I've added one Activity to it. Saved it. Created another Activity. I would expect the first Activity to appear in the toolbox so I could drag it into my workflow, but it's not. Any ideas? ...

Difference between CLR 2.0 and CLR 4.0

I have read countless blogs, posts and StackOverflow questions about the new features of C# 4.0. Even new WPF 4.0 features have started to come out in the open. What I could not find and will like to know: What are the major changes to CLR 4.0 from a C#/WPF developer perspective? What are the major changes to CLR 4.0 as a whole? I th...

Entity Framework/.Net 4.0: POCO and saving many to one relationships

How do I have to set up a property so that when using SaveChanges, the many to one relationship is saved and I don't get the: INSERT statement conflicted with the FOREIGN KEY constraint... error. Pretty simple, I have an Ad and an AdType where there are many Ads to one AdType. There is a property on Ad: public class Ad { public I...

Did somebody tried to recompile NHibernate for .NET 4.0 Beta 2?

Did somebody tried to recompile NHibernate for .NET 4.0 Beta 2? ...