Tuesday, June 06, 2006
Support For LEGO and Skype Sample Projects

We've been getting quite a few emails lately regarding support for Microsoft's LEGO and Skype starter kits from MSDN. While we did develop these samples, we're unable to provide public support for them. Ordinarily, we don't get any requests for sample support, but these two projects have slightly different circumstances that have caused people some problems. This entry is intended to outline common issues and easy ways to get around them.

The first issue is a matter of history. We delivered these samples to Microsoft in June 2005 (Skype) and November 2005 (LEGO). Both were built using pre-release versions of the .NET Framework 2.0 and Visual Studio 2005. However, they weren't shipped until April 2006, well after Visual Studio 2005 had RTM'd. As a result, some issues that come up are due to changes in the final .NET Framework 2.0. For example, there is a bug in the VB piano sample of the LEGO project where an enum is parsed. It wasn't a bug in Beta 2, but is in RTM. As a result, they both worked when we handed them off, but break for people (at runtime) on RTM, even though they still compile. I know the piano app worked, for example, because there's a video on MSDN showing it working.

Another issue is versioning. We developed and tested the Skype library against 1.0.2.48, which was the most recent stable version at the time. There are workarounds and tweaks in the code to account for several bugs in the Skype interop at the time, as well as places where code got pretty messy just due to dealing with the WM_COPY interop mechanism they use. Skype 2.0+ has shipped since then, and we've found that some of the issues we "worked around" have been fixed, and the workarounds themselves are potentially causing trouble, whereas new issues have snuck into the base Skype API that we have no control over.

A final issue, and this could fall into multiple categories, is one of deployment. Both of these projects rely heavily on C++/CLI and the Visual C++ runtime (CRT). Most people have a version of the VCRT on their machines or can download and install them from Microsoft. However, only developers who have Visual C++ installed have the debug version of this runtime. Since both the Skype and LEGO projects seem to have been packaged for deployment using the debug version (this was not done by SharpLogic), people who don't have Visual C++ 2005 installed are likely to see:

Could not load file or assembly 'SharpLogic.Skype , Version=1.0.2299.29912, Culture=neutral, PublicKeyToken=null' or one of its dependencies. This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)

or

Could not load file or assembly 'C4F.LegoRcx, Version=1.0.2239.29242, Culture=neutral, PublicKeyToken=null' or one of its dependencies. This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)

This is [probably] due to the dependency on the debug version of the CRT, which probably isn't installed. If you're using the Skype library, replace SharpLogic.Skype.dll with this file: SharpLogic.Skype.zip (33.93 KB). You should also update the references to it. For the LEGO project, I recommend you install Visual C++ 2005 Express, which should give you the debug CRT bits. If you want to build something to run on a machine without the debug CRT bits, build the C++ version of the C4F.LegoRcx in release mode and use the resulting DLL to in place of the existing DLLs you're referencing. I just learned that after downloading the ridiculous 17.3 MB version of the C++ version (it includes the NCBs--no, I don't know why either) that it doesn't include the core library source, so you can't rebuild those bits. Also note that the C++ project in the download is broken now, so you'll need to copy the GhostAPI.dll, PbkComm32.dll, and PbkUsbPort.dll files into the runtime directory (such as [project]\Debug) before running it or you'll get a FileNotFoundException.

Microsoft is aware of the issues raised here (and by others) but things are pretty busy, so it may take a little while longer until the downloads are updated. In the meantime, I hope this post helps. To reiterate, we can't provide support for these. If your company happens to need custom development related to either of these, feel free to ping me regarding consulting.


6/6/2006 10:15:31 AM (Pacific Standard Time, UTC-08:00)  #    Comments [1]  

10/26/2006 8:32:36 PM (Pacific Standard Time, UTC-08:00)
Hi,
I have downloaded your new SharpLogic.Skype.zip, and I installed Skype(ver 2.5.4.130) on my computer. when I run the Starter kid,
there is an error at this._skype.Contacts:

System.NullReferenceException was unhandled
Message="未将对象引用设置到对象的实例。"
Source="System"
StackTrace:
在 System.Text.RegularExpressions.Regex.IsMatch(String input)
在 SharpLogic.Skype.SkypeWindow.SendMessageToSkypeAndWait(String message, Regex pattern, Int32 resultIndexStart, Boolean toEnd)
在 SharpLogic.Skype.SkypeWindow.SendMessageToSkypeAndWait(String message, Regex pattern, Int32 resultIndexStart)
在 SharpLogic.Skype.SkypeWindow.SetProtocol(Int32 number)
在 SharpLogic.Skype.SkypeWindow.OnAPIConnectionStatusChanged(String status)
在 SharpLogic.Skype.SkypeWindow.WndProc(Message& message)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
在 PeekMessageA(tagMSG* , HWND__* , UInt32 , UInt32 , UInt32 )
在 SharpLogic.Skype.SkypeWindow.CheckForAndProcessNextMessage()
在 SharpLogic.Skype.SkypeWindow.Connect(Int32 timeoutInMilliseconds)
在 SharpLogic.Skype.SkypeWindow.Connect()
在 SharpLogic.Skype.SkypeWindow.OnAPIConnectionStatusChanged(String status)
在 SharpLogic.Skype.SkypeWindow.WndProc(Message& message)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
在 DispatchMessageA(tagMSG* )
在 SharpLogic.Skype.SkypeWindow.CheckForAndProcessNextMessage()
在 SharpLogic.Skype.SkypeWindow.Connect(Int32 timeoutInMilliseconds)
在 SharpLogic.Skype.SkypeWindow.Connect()
在 SharpLogic.Skype.SkypeWindow.OnAPIConnectionStatusChanged(String status)
在 SharpLogic.Skype.SkypeWindow.WndProc(Message& message)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
在 DispatchMessageA(tagMSG* )
在 SharpLogic.Skype.SkypeWindow.CheckForAndProcessNextMessage()
在 SharpLogic.Skype.SkypeWindow.Connect(Int32 timeoutInMilliseconds)
在 SharpLogic.Skype.SkypeWindow.ConnectedToSkype()
在 SharpLogic.Skype.SkypeWindow.SendMessageToSkype(SByte* message)
在 SharpLogic.Skype.SkypeWindow.SendMessageToSkype(String message)
在 SharpLogic.Skype.SkypeWindow.SendMessageToSkypeAndWait(String message, Regex pattern, Int32 resultIndexStart, Boolean toEnd)
在 SharpLogic.Skype.SkypeManager.get_Contacts()
在 SharpLogic.Skype.ChatSampleCS.Form1..ctor() 位置 F:\My Documents\My Prog\专题\skype\Skype Starter Kit CS\SharpLogic.Skype.ChatSampleCS\Form1.cs:行号 26
在 SharpLogic.Skype.ChatSampleCS.Program.Main() 位置 F:\My Documents\My Prog\专题\skype\Skype Starter Kit CS\SharpLogic.Skype.ChatSampleCS\Program.cs:行号 16
在 System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Threading.ThreadHelper.ThreadStart()


Can you help me?
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):