1 / 41

Compact Framework .NETcf : from the trenches

Compact Framework .NETcf : from the trenches. casey chesnut brains-N-brawn.com 12/15/2003 Harvard for David Platt’s .NET class. Questions. Language C#, VB .NET, C++, Java At work .NET, .NETcf CE. Experience. Web Services Compact Framework Tablet PC Speech .NET. Compact Framework.

aelan
Download Presentation

Compact Framework .NETcf : from the trenches

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Compact Framework.NETcf : from the trenches casey chesnut brains-N-brawn.com 12/15/2003 Harvard for David Platt’s .NET class

  2. Questions • Language • C#, VB .NET, C++, Java • At work • .NET, .NETcf • CE

  3. Experience • Web Services • Compact Framework • Tablet PC • Speech .NET

  4. Compact Framework • Mappoint .NET Client • LBS – GPS, MapPoint, SQL NS, MSN Mess. • Signature Biometric • Speech Recognition – DIME & SAPI WS • Managed DirectPlay Wrapper for PPC • ASP.NET-like Web Service server • Port of a 75K –> 100K line WS app • ~20 web services, ~175 web methods • Cryptography and Client-side WSE

  5. Agenda • [ Keith Pleas Intro. ] • [ SmartPhone and WSE article? ] • What is missing • How to get it back • Where we are now • Futures • Resources

  6. What Is Missing • Assemblies • Namespaces • Types • Events • Properties • Methods • Overloads • Behavior

  7. .NETfx versus .NETcf System.Web System.WinForms Services UI Design ComponentModel Description HtmlControls Discovery WebControls System.Drawing Protocols Caching Security Drawing2D Printing Text Configuration SessionState Imaging System.Data System.Xml ADO.NET SqlClient XmlDocument Serialization Reader/Writers Design SqlServerCe Xslt/XPath System Collections IO Configuration Runtime InteropServices * Security Net ServiceProcess Remoting Text Reflection * Diagnostics Serialization Globalization Resources * Threading

  8. .NETfx Types: 4,753 Methods: 80,277 .NETcf Types: 1,360 Methods: 18,701 Metrics * mscorlib, system, system.data, system.drawing, system.windows.forms, system.xml * .NETcf adds SqlCe and IRDA namespaces

  9. Examples • Typed DataSets (.xsd) • Resource files (.resx) • Hardcoded strings • Registry keys • Environment variables • File paths • Types • Sealed • Partial implementations

  10. Examples • pInvoke • Unicode • MarshalAs • FieldOffset • Missing or different DLLs • Missing or different OS features • WMI • Hosts • Updating controls from thread • Bugs

  11. How To Get It Back • Open source efforts • 3rd party controls • pInvoke • CE .NET Win32 APIs • eVC++ thunk layer • Write the logic yourself

  12. Open Source • go-mono.org • “Effort to create an open source implementation of the .NET Development Framework” • Not intended for CE • Be aware of licensing • ssCli / Rotor • MS initiative • Academic licensing only • Port to CE .NET underway

  13. OpenNetCF.org • Smart Device Framework (~January 2004) • Audio recording and playback, serial communication, registry and clock manipulation, notifications, environment setting, extended marshaler • 10 controls with designer support: Button, CheckBox, GroupBox, ColorDialog, LinkLabel, StatusBar, owner-drawn ListBox and SignatureCapture control

  14. 3rd party controls • Odyssey CfCom • InstallShield Developer Mobile Edition • Preemptive Dotfuscator • /n Software’s IP*Works for CF • ComponentOne Studio for Mobile Devices • Xceed Zip for .NETcf • IntelliProg UI controls • HP thumbprint biometric

  15. pInvoke • VB .NET cant do unsafe • Call C# library if necessary • Only 32-bit blittable types • Pass by ref • Strings • unicode only, use StringBuilder • No callbacks from native code • MessageWindow • Make blocking call into native code

  16. pInvoke • coredll.dll has 1600 functions • Cant handle nested structures • Flatten into byte arrays • Manually marshal • Managed pointers • DLLImport CE & XP pattern for keeping common codebase • Native thunking layers

  17. Write it yourself

  18. .NETcf extended System.Web System.WinForms Services UI Design ComponentModel Description HtmlControls Discovery WebControls System.Drawing Protocols Caching Security Drawing2D Printing Text Configuration SessionState Imaging System.Data System.Xml ADO.NET SqlClient XmlDocument Serialization Reader/Writers Design SqlServerCe Xslt/XPath System Collections IO Configuration Runtime InteropServices * Security Net ServiceProcess Remoting Text Reflection * Diagnostics Serialization Globalization Resources * Threading

  19. Where We Are Now

  20. Development • Use eVC++ tools with device • Can do command line builds • Ports of nUnit • Get ethernet to device • VS.NET supported by .NETcf line • Class Library Comparison Tool • Windows Mobile Developer Power Toys

  21. Emulator • Same image as run on device • 80% speed of device • Newer ones can do GAPI • eVC++ can share folders • Can sometimes active sync • Cannot listen • Ultimately need a slew of devices

  22. Debugging • System.SR.dll • OutputDebugString • No console • TraceListeners • No event log (to file) • Use the device • Cannot attach to process • Cannot skip to next statement • Cannot do mixed native and managed • Native threads will not break

  23. pInvoke Debugging • Cross platform pInvoke signatures • SetLastError, Marshal.GetLastWin32Error • Exceptions • NotSupportedException • MissingMethodException • Look at .h files • dumpbin /exports (name mangling) • P/Invoke Wizard

  24. Data • Web Services • XML • DB API • Pocket Access • CSV • 3rd party • SQL

  25. SQL • Connected – Sql Server • Disconnected – SQL CE • Replication • No concurrent access • No stored procedures • Basic SQL support • Runs in process • Can become corrupted

  26. Garbage Collection • Not generational • Mark and sweep aggressive • Compacting is rare • Code pitching has never happened when i was watching • pInvoke memory leaks • Platform builder / cordbg • mscoree.stat

  27. Performance • 2 JITS (ARM & other), No NGEN • ARM is supposed to be twice as fast • Machine code is generated, but not much • UI is ~20% slower on device • Tech preview was interpreted • Release builds are slower • No profiling tools • Environment.TickCount • QueryPerformanceCounter • SP2 has some significant resource and xml handling speed ups

  28. What is slow • XmlDocument • Reflection • Catching Exceptions • pInvoke • DataSets • Web Services • Data Binding

  29. Faster • SQL CE replication • Do not freeze the UI • Pre-init behind the scenes • Re-use objects • StringBuilder • Batch pInvoke calls in thunking layer • Use XmlTextReader / XmlTextWriter • Drawing controls top-down, parents 1st

  30. Final Thought • Remember that these are Embedded Devices!

  31. Futures • SmartPhone 2003 • Whidbey (.NETcf) • Predictions

  32. SmartPhone 2003 • 2002 OS does NOT support .NETcf • No future support announced by MS • 2002 release just now happening in US • No upgrade path announced by carriers • 2003 release happening in Europe • .NETcf is basically unchanged • Missing some UI controls • Missing SQL Server CE

  33. Whidbey • eVC IDE integrated into VS .NET • Mixed native and managed • Remote tools • Attach to running process • Language updates • Generics, Iterators, Anonymous methods • Performance • Execution engine, JIT, profiling • Interop • COM RCW, Marshalling, Runtime hosting

  34. Whidbey • Emulator • ActiveSync, Shared Folder, Stateful, Orientations • WinForms • Docking, Anchoring, Tabbing, Auto-scroll, Clipboard, Extend existing types, Multi-resolution • Controls • WebBrowser, DateTimePicker, MonthCalendar, LinkLabel, Notification Balloon, DocList, RichInk, Splitter, DataContainer, UserControl, HelpProvider

  35. Whidbey • Protocols • IPv6, Kerberos, NTLM, SOAP 1.2 • XML • XPath, Schemas, Serialization • SQL CE 3.0 • SqlCeResultSet • BCL • Image, Messaging, Registry, Cryptography • Serial, Sound

  36. Whidbey • Direct3D, DirectDraw • Notifications of system state • POOM • Telephony • Device Configuration • Location Services

  37. Predictions • HREF EXEs (CAS?) • SPOT • 384K RAM, ~1 meg flash, 27Mhz • OS = HAL + CLR • Only what is needed • Interpreted • Car .NET • Longhorn • Modular

  38. Resources • Newsgroups (microsoft.public.) • dotnet.framework.compactframework • smartphone.developer • Source • OpenNetCF.org, go-mono.org, ssCli / Rotor • Spelunking • Reflector, Anakrino, ILDasm

  39. Portals • microsoftdev.com • MS .NETcf FAQ • devbuzz.com • pocketpcdn.com • dotnetdn.com

  40. Books • .NET Compact Framework (MS Press) C# • .NET Compact Framework Kick Start (Sams) C# & VB • Definitive Guide to the .NETcf (Apress) VB • SQL Server CE Database Development with .NETcf (APress) • Building Solutions with the .NETcf (Addison) • Programming the .NET Compact Framework (?) C# and VB.NET

  41. Questions

More Related