One day I've decided to install WinFX (along with VS 2005 beta 2) on my laptop to see how it works on hardware accelerated graphics (I take a look at WinFX before - in VMWare Workstation though). So I installed everything as requested. The first step to test it was to run XAML Pad, a utility to build UI using XAML. No go. I took a look at Fusion Log Viewer (fuslogvw) I saw that XamlPad application tried (unsuccessfully) to load totaly unrelated 3rd party assemblies built for .net 1.x (plus some of .net 1.0 system assemblies). Go figure. I haven't put much effort into solving this (who has time to play these days). I've rather posted a reply to a guy having same problem in MS newsgroup microsoft.public.windows.developer.winfx.avalon ("XamlPad.exe NullReferencException with WinFX CTP Sept." thread).
After a while, Daniel Danilin found (in another post in same thread) an (obvious) solution: remove offending 3rd party (not .net 1.x system ones) assemblies from GAC. While this solution isn't perfect (what about applications that use those assemblies?) it just works - and I have something to play with while traveling to my second MVP summit.
In case you didn't know, MS has put up three forums (part of their Technical Forums) to discuss Linq, DLinq and XLink.
You'll find them here.
I've posted my first CodeSmith template for generating DLinq classes (DLink is part of Linq project, a future of .net). The generated code is C#. You can make suggestions or just give feedback in this forum.
Get the template here.
There was a question on MS' forum about how to log the DLinq's sql commands. Well, actually DataContext's sql commands. Here is the solution, it is easy:
StringBuilder sb = new StringBuilder(); // create a StringBuilder instance to store output
TextWriter tw = new StringWriter(sb); // create a StringWriter that will write into StringBuilder above
db.Log = tw; // attach it to DataContext
Console.WriteLine(sb.ToString()); // output the result
The trick is to use DataContext.Log property (db represents DataContext instance in this example) to attach a valid TextWritter derived instance. And voila - no more black box. Of course, output will be empty unless there is a sql command issued either by doing query or persistence.
I am doing some tests with DLinq. I have created my classes properly decorated with attributes. I have also implemented IChangeNotifier to make tracking faster (all this was created by my CodeSmith template which I will post later). However I couldn't persist a simple change which left me scratching my head for a while. Here is my pseudo code:
Load an entity
Change its property
Simple, huh. Yet nothing was saved. I've checked with SqlProfiler to see if anything is going on - and no, there was no update command issued which indicated that DataContext was unaware of any change. At one point in time I've commented out IChangeNotifier implementation and the thing started working normally, as one would except. After another while I've found the problem - I was calling OnChanging() too late:
if (value != id)
id = value;
Moving OnChanging one row up fixed the problem: set
if (value != id)
id = value;
This seems logical as OnChanging implies that is should occur before change is persisted. Another mystery solved.
Whoa, Visual Studio 2005 Team Suite Release Candidate is available for download at MSDN subscriber downloads. There is also a bunch of Sql Server 2005 September downloads. Apparently this is one and only RC before RTM.
Microsoft servers are under heavy load of course. I've barely managed to get to the link.
I wonder why :-)
RemObjects' Alef pointed me to this wonderful piece of code. Warning: whatever you do, don't write such code. Ever.
While you are in the mood, go check the story of Champions.
A lot of people have noticed a highly annoying bug in Visual Studio 2005 when dealing with Developer Express' controls. The description of the bug goes like this:
During the build of the solution IDE starts throwing a modal dialog box with error icon: "cannot access a disposed object. Object name: 'DesignerFrame'". If you click OK the same dialog reappears and you'll never get rid of it (regardless if you click OK or not) and you won't be able to close IDE either (you have to resort to Task Manager for killing it). Regardless of the issue the solution starts running if it was built properly.
AFAIK this is the problem in Visual Studio 2005 Beta 2 and there are two workarounds to this problem:
- upgrade to a CTP later then beta 2 (preferably july CTP since there is no public august CTP version of DevExpress controls) where error doesn't appear anymore
- close all designer windows within IDE before doing build