.net-4.0

Debugger.Launch() is now crashing my windows service after upgrading to .NET 4.0

For debugging environments, we have a conditional Debugger.Launch statement in the code to allow developers to debug into the startup code of the windows service. We just upgraded to .NET 4.0 today. Since the upgrade, if we exit out of the JIT window (i.e. we chose not to debug), the Windows Service is crashing (process is terminating). ...

.NET 4.0 Calendar control member SelectedDate is of type "DateTime?" ?

In .NET 4.0 if you create a Calendar and you look at the SelectedDate field it is of type "DateTime?". What's the deal with the ? at the end of the type? ...

.NET 4.0 and his Web.Config's XDT

Hello, I'm trying to use the XDT in a 4.0 web application and I just don't figure out how! I know this is maybe weird (At least, all thread I've read since then, everybody seems to do it easly but hum, not me!!). Nothing working. Here's what I've tryed : Here's my Web.Debug.Config : <?xml version="1.0"?> <configuration xmlns:xdt="http...

.NET 4 Serial Port ObjectDisposedException on Windows 7 Only

This is a problem I used to have all the time with the serial port class in .NET 2.0. It was suggested that upgrading to .NET 4 would fix the problem... and it did in almost all cases. If I am using the serial port class built-in to .NET to communicate with a USB-to-serial adapter, and the adapter is unexpectedly unplugged while the po...

Configuring a simple WCF Service Endpoint in a ASP.NET MVC 2.0

I'm building a simple ASP.NET MVC 2.0 web application. I'd like to serve up a AtomPub endpoint so that I can publish/update content from Windows Live Writer. I originally went down the path of implementing the AtomPub protocol as an Controller with a set of custom ActionResults. That worked until I tried to get authentication working, wh...

exception when incoming message modified for a method with "not blank" Uri template

I get the following exception when i modify the incoming Message for a web service method with URItemplate which is not blank. System.IndexOutOfRangeException: Index was outside the bounds of the array. at System.ServiceModel.Dispatcher.UriTemplateDispatchFormatter.DeserializeRequest(Message message, Object[] parameters) at System.Servi...

Is anything good/bad/unnecessary about this use of a public member?

Here is a synopsis of my code which is a moderately complex WinForms GUI. The context of the dependencies is the model view presenter pattern. public class StatSyncherFormView : Form, IView { ... } public class Presenter { // Here is the member I made public public readonly IView view; public Presenter(IView view) { ...

Is there a chance to replace a while loop with the TPL?

Hi there, I've a two while loops, which I will have run parallel with the TPL. My code : public void Initialize() { cts = new CancellationTokenSource(); ParallelOptions options = new ParallelOptions(); options.CancellationToken = cts.Token; options.MaxDegreeOfParallelism = Environment.ProcessorCount; task = Task.Fac...

When is ASP.Net 4 available on a server

Hi, i was building a new small website for an existing client, and thought about building it with ASP.Net 4. But in the apppoolsettings, i could only choose framework 2.0, so i guessed that 4.0 is not available on the server. Is it something i have to install on the server, or will it be installed via windows update somewhere in time? ...

Custom serialization/deserialization over a field with Entity Framework 4

Hi all, I'm in charge to migrate our own DAL to a solution based on Entity Framework 4 but, before I can do it, I need to be sure it's possible to translate all our "constructs" to this new technology. One of the biggest issues I'm having is the possibility to read a field and build a custom type. Valid examples could be a bit mask sav...

WPF and Sliverlight toolkit vs .Net 4

I could not get answer to this question anywhere, then thought maybe educated community here can shed some light. Somewhere it was mentioned that WPF and Silverlight toolkit would be implemented as part of .Net4. So we can use their features directly from .Net4, without installing these toolkits. Is it true? Thanks. ...

LINQ expression to optimize syntax?...

foreach (var item in mainCanvas.Children) { if (item is Button) { (item as Button).Content = "this is a button"; } } Can I use LINQ or other feature of .NET 4 to be more concise (maybe performant)? ...

Weird behavior with the ObjectStateEntry's State

Hi all, I have the following extension method and i'm not sure why each entrys state is being changed to Unchanged after i call entry.AcceptChanges() on one entry. public static void SaveWithLogging(this ObjectContext context) { IEnumerable<ObjectStateEntry> entries = context.ObjectStateManager.GetObjectStateEntries(Ent...

c#: Enqueued event for Queue<T>

Hello, I am new to event and delegates. Could you point me to the right direction for implementing Enqueued event for an object of type Queue<T>? I am using C# and .Net 4.0 Thanks ...

c#: lowering priority of Task.Factory.StartNew thread

Hello, If you are reading this (hoping you will be able to help me!), you most probably know that a code like below will start a new thread to do the job. Is there any way I can control the priority of that thread? Task.Factory.StartNew(() => { // everything here will be executed in a new thread. // I want to set the priority o...

Running .NET 3.5 built Mixed mode assemblies in .NET 4 using app config requires Framework 3.5 as well

This is similar to already created thread here: http://stackoverflow.com/questions/3179028/mixed-mode-assembly-in-net-4 Using the app config, I was able to force the assemblies to run on .NET 4. On an XP Machine, I installed just the .NET 4 (without .NET 3.5 or 2.0) and tried to run the built application. It fails to load the mixed mode...

DOFactory Design patterns. Anyone bought it ??? IS it any good

anyone bought the dofactory Design Patterns Framework ??? Did you find it to be any good??? http://www.dofactory.com/Framework/Framework.aspx thanks Niall ...

Linking to a .Net v2.0 assembly from a .Net v4.0 assembly also appears to link (and alias) mscorlib v2.0. Why?

I have a .Net assembly which imports an assembly linked against the v2.0 runtime. The problem I'm having is that when I try to run some tests on my assembly, Fusion trys to load the wrong version of a dependent assembly. After looking at the assembly manifest, I can see why: the wrong version of FSharp.Core is linked. In my build file,...

SSCLI (Rotor) for the v4.0 clr?

Does anyone know if there is (or will be) an SSCLI release for the v4.0 runtime? ...

ListBox is selecting many items even in SelectionMode="Single"

I have encountered something very strange, simple WPF application <Window x:Class="ListBoxSelection.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <ListBox ItemsSou...