Had to sleep in today, so didn't catch the general session. I've been trying to focus on sessions that talk about current issues, rather than Longhorn and friends that we won't be using for a couple years.
Breakout sessions here have been packed! Most of them spill out into the hallways, sitting on the floor, watching the session from the flat panel out there.
Interop pitfalls -- turns out I'd heard about most of this already. Minimize roundtrips to unmanaged code. A couple new items:
- Default char set for unmanaged code wrappers is ANSI. Use attribute to change this to Unicode if you can, especially if you're calling Win32 APIs. Managed code is Unicode, so transition to ANSI just to call your P/Invoke, which will turn around and get converted to Unicode for the Win32 API - expensive. Sample screen saver code demo ran much faster just with Unicode attribute on the native code library.
- Class that wraps Win32 Handle that you pass to a P/Invoke function. The GC sees the CALL to the function as the last use of the handle class. As of the CALL to the function, the GC can now potentially collect the handle class -- YIKES. May not WAIT until the call RETURNS. Not sure how to get around this -- maybe reference/use the class after the call?