DCSIMG
CLR - Pavel's Blog
Sign in | Join | Help

Pavel's Blog

Pavel is a software guy that is interested in almost everything
software related... way too much for too little time

Browse by Tags

A ‘Proper’ WeakReference Class
04 June 11 12:12 PM | pavely | 1 comment(s)
The WeakReference class that exists since .NET 1.0 can be used to wrap an object while not being the one keeping it alive. This may be useful in an “Observer” pattern scenario, where a client registers for some notification, but “forgets” to unregister. That means that with a normal reference, even if the client is no longer needed, it keeps getting notifications because the server object keeps a strong reference to the client. Here’s a simple example: class BasicSubject {     List...
תגים:, , ,
PSSCOR4 Debugger Extension Released
29 April 11 07:04 PM | pavely | with no comments
A while back, Microsoft released the PSSCOR2 debugger extension for WinDbg, supporting more command than the classic SOS.DLL. This was for CLR v2 (.NET 2-3.5). Now a similar extension has been released for CLR 4 (.NET 4). You can download it here . There are versions for x86 and x64. The easiest way to use them is copy the relevant DLL to the .NET framework directory for the corresponding “bitness” (where SOS lives, something like C:\Windows\Microsoft.NET\Framework\v4.0.30319 (32bit) or C:\Windows...
Windows Platform Developers User Group meeting
06 October 10 10:45 PM | pavely | 3 comment(s)
This evening was a WPDUG meeting on CLR hosting and CLR profiling. Thank you all for coming! It was a pleasure to see so many of you there. My session was on CLR hosting, using the new CLR 4 hosting API. This is done using native code (C++) that uses COM for communication between the CLR and the host, both ways. I showed how to enumerate the installed runtimes, how to load a specific CLR (a new feature of CLR 4 – the ability to host multiple CLRs in a single process), how to create an application...
My C# 5.0/CLR 5 Wish List
22 August 10 01:54 PM | pavely | 10 comment(s)
C# 5.0 is probably in the works (for sure). A while back I blogged about features I’d like to see in C# 4.0 . I didn’t get any of my wishes (well, maybe I got one wish in an unexpected way, more on that later). Here’s a list of features I’d love to see in the next version of the C# language and the CLR. It’s not yet Christmas, but maybe Microsoft’s Santa needs some time to make these wishes come true: operator constraints This is something I wished for with C# 4.0, but didn’t get. Well, I actually...
תגים:, , , ,
My Developer Academy 4 Session
22 March 10 08:29 PM | pavely | 2 comment(s)
Today, I presented the session entitled “.NET 4: What’s new in the CLR and BCL?”. Thank you all for attending! I didn’t get the chance to do all the demos I wanted because of time constraints (I always try to stuff more that is possible in the allotted time, and even “stole” a few minutes extra), but I hope the message went through: there are improvements all over the board that will impact almost any type of application. I suggest you download the demos and slides from the developer academy 4 site...
WeakReferences and Events
07 January 10 01:35 PM | pavely | 2 comment(s)
One of the well-known pitfalls of using events, is the holding of the subscriber instance by the publisher (if connecting to a delegate holding an instance method). If the subscriber forgets to unsubscribe, the instance cannot be garbage collected because the publisher holds a reference to it. Worse yet, the subscriber continues to receive event notifications even though it’s not interested. One way to deal with this is presented in Jeffrey Richter’s book “CLR via C#” . The idea is based on a custom...
תגים:, , ,
PDC Report: Day 3
30 October 08 11:07 AM | pavely | with no comments
In my previous report , I forgot to mention one more significant product update: Office. The next version of Office (“Office 14”) will have an online version, complete with the famous Ribbon and all major editing capabilities. In addition, synchronization services will allow nice, seamless sync between an online and offline versions, including the ability to open the same file by multiple users for editing with automatic or manual updates. On with day 3! Today’s keynote was by Rick Rashid, the head...
Writing a .NET Profiler
20 May 08 09:36 AM | pavely | 2 comment(s)
I was recently asked how a managed application can know the actual size of managed objects it allocates. Although there exists a Marshal.SizeOf method that seemingly can do the trick, this only works for value types, as the method is intended to be used in interop scenarios where some unmanaged memory must be allocated in managed code and passed to some unmanaged function. This question, and others like it can best be answered by using a the .NET profiling API. The .NET profiling API allows the ...