Yun Jin's WebLog

CLR internals, Rotor code explanation, CLR debugging tips, trivial debugging notes, .NET programming pitfalls, and blah, blah, blah...

  • Yun Jin's WebLog

    Special threads in CLR

    • 15 Comments
    Question: How many threads does a typical managed process have when it just starts to run? Answer: regardless how many threads the user creates, there are at least 3 threads for a common managed process after CLR starts up: a main thread which starts...
  • Yun Jin's WebLog

    OutOfMemoryException and Pinning

    • 10 Comments
    As you all know, in CLR memory management is done by Garbage collector (GC). When GC can't find memory in preallocated memory chunk (GC heap) for new objects and can't book enough memory from the OS to expand GC heap, it throws OutOfMemoryException (OOM...
  • Yun Jin's WebLog

    FCall and GC hole - first post about Rotor

    • 5 Comments
    An exsample of FCall My friend Joel Pobar had a great post to demo how to add new code to Rotor which exposes more EE(Execution Engine) internal information to managed world. This is a very good example covers both BCL and EE, and how the two parts...
  • Yun Jin's WebLog

    Dangerous PInvokes - string modification

    • 5 Comments
    Objects in CLR are usually managed by the runtime in GC heap; user code does not have direct access to the objects. CLR's reliability and type safety heavily rely on this fact. But CLR also support InterOp features like COM InterOp, IJW and PInvoke to...
  • Yun Jin's WebLog

    Thread safety of Timer callbacks

    • 5 Comments
    I didn't realize I've stopped blogging for 1 year. What a shame! Fortunately I didn’t waste the time: we ship Whidbey Beta1 and Beta2 in the past year! Now with Beta2 out of door, I have more spare time for blogging. :) Today I want to talk about some...
  • Yun Jin's WebLog

    Thread, System.Threading.Thread, and !Threads (III)

    • 5 Comments
    I got email asking me to explain !Threads output in details. I think this is a good question and a good topic for another installment to the series. Here is an example I'll use for this post: 0:055> !threads ThreadCount: 202 UnstartedThread...
  • Yun Jin's WebLog

    Thread, System.Threading.Thread, and !Threads (I)

    • 4 Comments
    If you use SOS’s !Threads command during debugging a lot, you should be familiar with such output: 0:003> !threads PDB symbol for mscorwks.dll not loaded Loaded Son of Strike data table version 5 from "C:\WINDOWS\Microsoft.NET\Framework\v1.1...
  • Yun Jin's WebLog

    Hello world!

    • 4 Comments
    Hello, everybody. I'm Yun Jin, a dev works in CLR's Quick Response Team under Michael Stanton . As Michael mentioned in his blog, our job mostly involves debugging, analyzing and fixing all kinds of weird stress failures in CLR and partner teams. CLR...
  • Yun Jin's WebLog

    Figure out variable lifetime using SOS

    • 3 Comments
    There is a bug in this program below, try to see if you could catch it. Test.cs (compiled to DelegateExample.exe): using System; using System.Threading; using System.Runtime.InteropServices; class Test { delegate uint ThreadProc (IntPtr arg...
  • Yun Jin's WebLog

    ExitThread() in managed program?

    • 3 Comments
    I've seen people calls OS's ExitThread in managed applications via PInvoke to exit a managed thread, like this: [DllImport( "Kernel32.dll")] public static extern void ExitThread(int exitCode); public static void Run () { ... // calling OS's ExitThread...
  • Yun Jin's WebLog

    Desctructor, finalizer, and Dispose - Part2.C++/CLI in Whidbey

    • 2 Comments
    I changed the program in previous post to use new Whidbey syntax. using namespace System; ref class RefT { public: RefT () {Console::WriteLine ("RefT::RefT");} ~RefT () {Console::WriteLine ("RefT::~RefT");} !RefT () {Console::WriteLine ("RefT...
  • Yun Jin's WebLog

    Thread, System.Threading.Thread, and !Threads (II)

    • 2 Comments
    With knowledge in my previous blog , we could avoid some mistakes in .NET programming. A C++ Thread is very resource heavy. It is associated with a lot of dynamically allocated memory and some OS handles. So it had better to be cleaned up ASAP after...
  • Yun Jin's WebLog

    Trivial debugging note - using WeakReference in finalizer

    • 2 Comments
    Some time ago I saw a problem from a partner team in Microsoft that an InvalidOperationException is thrown from WeakReference.IsAlive . WeakReference wraps weak GC handle implemented in CLR's Execution Engine ( GC handle is also exposed by System.Runtime...
  • Yun Jin's WebLog

    A developer's view of Workflow

    • 1 Comments
    This is my first blog post about Windows Workflow Foundation (WF) on the "Go with the flow" team blog . In the post I briefly described some key benefits of Workflow as a programming language: Declarative programming, Continuation, Persistence, and instance...
  • Yun Jin's WebLog

    Trivial debugging note - what catch(…) can’t catch

    • 1 Comments
    One day I was debugging a problem where a Waston dialog popped up on a process. What surprised me was that on the stack where Waston was triggered, there was a unmanaged C++ function with a try-catch(…) block. To my understanding, this block should catch...
  • Yun Jin's WebLog

    Desctructor, finalizer, and Dispose - Part 1.managed C++ extension in V1.X

    • 1 Comments
    As a C++ fan, I'm a long time admirer for deterministic finalization. I think introduction of garbage collection to C style language by Java and .Net is a huge improvement. However, I found lose of deterministic destructor is almost unacceptable when...
  • Yun Jin's WebLog

    How handy auto-boxing could be!

    • 0 Comments
    I've been quiet for 3 months and probably won't have much time for blogs for next several months down the road. Today I got a chance to update my post OutOfMemoryException and Pinning to correct a mistake pointed out by our GC architect Patrick Dussud...
  • Yun Jin's WebLog

    Workflow Foundation 4.0 Activity Model (I)

    • 0 Comments
    I just posted one entry in our "Go with the Flow" team blog to explain Workflow foundation V4's Activity Model. In the blog, I discussed how Workflow is composed of Activities and introduced basic Activity programming model in WF4. I quickly went over...
  • Yun Jin's WebLog

    Workflow Foundation 4.0 Activity Model (II)

    • 0 Comments
    I just posted the 2nd half of introduction to WF4's Activity Model . In this blog, I have given examples of building 2 activities with 4 different authoring styles: how to build a leaf activity (HttpGet) using CodeActivity and AsyncCodeActivity; and how...
  • Yun Jin's WebLog

    Workflow Foundation 4.0 Activity Data Model (I)

    • 0 Comments
    This is my first post about WF4's Activity Data Model . The focus of this post is a high level principle which drives data model redesign between WF3 and WF4: separation of data and program. WF3 has Activity's runtime state stored in the Activity itself...
  • Yun Jin's WebLog

    Workflow Foundation 4.0 Activity Data Model (II)

    • 0 Comments
    Here comes sequal of my WF4 Activity Data Model blog . This post focuses on WF arguments: the Argument class hierarchy which models arguments for WF; how to "declare" an argument for an activity; the automatic reflection; how to deal with dynamic arguments;...
  • Yun Jin's WebLog

    The first wave of WF4 Activity Packs are released

    • 0 Comments
    I'm very happy to annouce that my team just released 2 pack of Activities for WF4 on CodePlex ! · State Machine Activity Pack . State Machine is one of the most common asks for WF4’s Activity Palette, especially for WF3 users. This Activity Pack includes...
  • Yun Jin's WebLog

    Workflow Foundation 4.0 Activity Data Model (III)

    • 0 Comments
    I finally finished the long overdued last installment of the Activity Data Model series . In this post, I focused on workflow variables. Conceptually workflow variables are very similar to variables in procedure programming languages like C#. But one...
  • Yun Jin's WebLog

    Hello world, again

    • 0 Comments
    I've disappeared for more than 4 years in blog space. During this time period, I left CLR team and worked for Microsoft's High Performance Computing (HPC) team for 3 years to build Windows based compute cluster infrastructure. One thing I'm particularly...
Page 1 of 1 (24 items)