Yi Zhang's MSDN Blog

Everything about the CLR - interop / WinRT / and other random stuff

Top secret .NET handles - Part 1 - Dependent handles

.NET publicly has documented 4 kind of handles: Weak (also called Short Weak) - Don’t keep target...

Author: Yi Zhang - CLR Date: 02/08/2018

Calling C functions from Python - part 3 - deep dive into ctypes implementation in CPython

Last time we’ve looked at using ctypes to call C API, and writing extension module using Python/C...

Author: Yi Zhang - CLR Date: 02/02/2018

Calling C functions from Python - part 2 - writing CPython extensions using Python/C API

In my previous post we’ve briefly looked at using ctypes module to call C APIs. In this post let’s...

Author: Yi Zhang - CLR Date: 01/27/2018

Calling C functions from Python - part 1 - using ctypes

Recently I’ve been evaluating Python interop technologies for a project at work and I think it’ll...

Author: Yi Zhang - CLR Date: 01/20/2018

C++ coroutine tutorial

I’ve been experimenting with coroutines recently and I found that information on C++ coroutines are...

Author: Yi Zhang - CLR Date: 10/28/2017

Writing your own lock-free reader/writer lock

It is sort of puzzling for me why C++ standard doesn't have a implementation of reader/writer lock....

Author: Yi Zhang - CLR Date: 10/07/2017

Sharing .NET generic code under the hood

If you come from a C++ programming background, you are most likely already familiar with C++’s...

Author: Yi Zhang - CLR Date: 04/01/2017

C# value type boxing under the hood

I recently had some really interesting discussion with a .NET typesystem expert in the team, and...

Author: Yi Zhang - CLR Date: 03/19/2017

Moving my blog to GitHub pages - https://yizhang82.me

I haven't posted in a good while - it's because I've been busy working on .NET native! Now that...

Author: Yi Zhang - CLR Date: 03/12/2017

Getting rid of TypeLoadException in your WinRT app

I've seen enough people asking about this so I thought I should talk about this in my blog. They see...

Author: Yi Zhang - CLR Date: 03/21/2014

Async talks on Channel 9

Even though I work on .NET interop and WinRT these days, async/await is still the one topic that...

Author: Yi Zhang - CLR Date: 03/16/2014

Avoiding C++ types in your P/invokes

It's easier to explain this in an example. Let’s say you have a export function in your native DLL:...

Author: Yi Zhang - CLR Date: 02/07/2013

WARNING: VS 2012 might break your broken P/Invoke

I'm seeing many people reporting that they are seeing strange P/invoke issues when they moved their...

Author: Yi Zhang - CLR Date: 01/24/2013

Marshal.GetHRForException does more than just Get-HR-For-Exception

Let's first start by looking at a small code snippet: if (Marshal.GetHRForException(myException) ==...

Author: Yi Zhang - CLR Date: 01/18/2013

Effective WinDbg breakpoints using hit counts

I learned this debugging trick from a colleague a few days ago when we are debugging a bug together...

Author: Yi Zhang - CLR Date: 03/07/2011

If your Windows Phone 7 doesn’t sync with Zune Software, try a different USB port

I recently got Samsung Focus but it doesn’t get recognized by the Zune Software – it says “No device...

Author: Yi Zhang - CLR Date: 12/21/2010

Interpreting HRESULTS returned from .NET/CLR: 0x8013XXXX

What is 0x8013XXXX Occasionally you might run into mysterious HRESULTs returned from .NET that...

Author: Yi Zhang - CLR Date: 12/17/2010