compact framework netcf from the trenches l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Compact Framework .NETcf : from the trenches PowerPoint Presentation
Download Presentation
Compact Framework .NETcf : from the trenches

Loading in 2 Seconds...

play fullscreen
1 / 44

Compact Framework .NETcf : from the trenches - PowerPoint PPT Presentation


  • 405 Views
  • Uploaded on

Compact Framework .NETcf : from the trenches. casey chesnut brains-N-brawn.com 12/13/2004. Questions. Language C#, VB .NET, C++, Java At work .NET, .NETcf Windows CE Questions are encouraged throughout the presentation. Experience. Pervasive / Seamless Computing

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Compact Framework .NETcf : from the trenches' - Sophia


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
compact framework netcf from the trenches

Compact Framework.NETcf : from the trenches

casey chesnut

brains-N-brawn.com

12/13/2004

questions
Questions
  • Language
    • C#, VB .NET, C++, Java
  • At work
    • .NET, .NETcf
  • Windows CE
  • Questions are encouraged throughout the presentation
experience
Experience
  • Pervasive / Seamless Computing
    • Web Services (ASMX, WSE)
    • Mobility (CF, Tablet)
    • Speech (Speech .NET, SAPI)
    • Location Based Services (MapPoint, GPS)
    • Security
    • Artificial Intelligence
compact framework
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
  • Client-side WSE 2.0 and WS-*
  • Barcode Image Reader
  • Custom Speech Recognition
  • Custom Text-To-Speech
agenda
Agenda
  • [ Platform Ahead CF Chapter ]
  • [ /cfWSE article(s)? ]
  • What is missing
  • How to get it back
  • Where we are now
  • Futures
  • Resources
what is missing
What Is Missing
  • Assemblies
  • Namespaces
  • Types
  • Events
  • Properties
  • Methods
  • Overloads
  • Behavior
netfx versus netcf
.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

metrics
Metrics

* Beta 1 Numbers for all assemblies

examples
Examples
  • Typed DataSets (.xsd)
  • Resource files (.resx)
  • Hardcoded strings
    • Registry keys
    • Environment variables
    • File paths
  • Types
    • Sealed
    • Partial implementations
  • Controls
examples10
Examples
  • pInvoke
    • Unicode
    • MarshalAs
    • FieldOffset
    • Missing or different DLLs
  • Missing or different OS features
    • WMI
    • Hosts
  • Updating controls from thread
  • Bugs
how to get it back
How To Get It Back
  • Open source efforts
  • 3rd party controls
  • OS
    • pInvoke CE .NET Win32 APIs
    • eVC++ thunk layer
  • Write the logic yourself
open source
Open Source
  • OpenNETCF.org
    • Smart Device Framework v1.2 July 15, 2004
    • Pocket PC Magazine Award Winner
  • Complementary to .NETcf
    • Adds missing functionality that desktop has
    • Adds functionality specific to devices
    • e.g. 15 controls with designer support
  • Visual Studio .NET Integration
  • Be aware of license
open source13
Open Source
  • go-mono.org
    • “Effort to create an open source implementation of .NET”
    • Not intended for CE
    • Platform independence is slow
    • Be aware of licensing
  • ssCli / Rotor
    • MS initiative
    • Academic licensing only
    • Port to CE .NET underway
3 rd party controls
3rd party controls
  • Franson GpsTools
  • /n Software’s IP*Works for CF
  • Field Software PrinterCE.NetCF
  • Odyssey CfCom
  • InstallShield Developer Mobile Edition
  • Preemptive Dotfuscator
  • ComponentOne Studio for CF
  • Xceed Zip for .NETcf
  • IntelliProg UI controls
  • HP thumbprint biometric
os pinvoke
OS (pInvoke)
  • VB .NET cannot 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
os pinvoke16
OS (pInvoke)
  • coredll.dll has 1600 functions
  • Cannot handle nested structures
    • Flatten into byte arrays
    • Manually marshal
  • Managed pointers
  • DLLImport CE & XP pattern for keeping common codebase
  • Native thunking layers
    • e.g. CF -> eVC++ -> COM
netcf extended
.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

development
Development
  • .NETcf support in VS.NET
  • Supplement with eVC++ tools
  • Can do command line builds
  • Ports of nUnit to run on a device
  • Use ethernet for debugging
  • Class Library Comparison Tool
  • Windows Mobile Developer Power Toys
emulator
Emulator
  • Same image as run on device
  • 80% speed of device
  • Newer emulators can do GAPI
  • eVC++ can share folders
  • Can sometimes active sync
  • Cannot listen
  • Ultimately need a slew of devices
debugging
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
debugging pinvoke
Debugging (pInvoke)
  • Cross platform pInvoke signatures
  • SetLastError, Marshal.GetLastWin32Error
  • Exceptions
    • NotSupportedException
    • MissingMethodException
  • Look at .h files
  • dumpbin /exports (name mangling)
  • P/Invoke Wizard, pInvoke.net
slide24
Data
  • Web Services
  • SQL CE
  • XML
  • DB API
  • Pocket Access
  • CSV
  • 3rd party
sql ce
SQL CE
  • Connected – Sql Server
  • Disconnected – SQL CE
  • Merge Replication
  • No concurrent access
  • Basic SQL support
  • No stored procedures
  • Runs in process
  • Can become corrupted
communication
Communication
  • Web Services
  • Sockets
  • System.IRDA
  • OpenNetCF Phone
  • OpenNetCF Bluetooth
  • OpenNetCF Wi-Fi
  • NO Remoting
garbage collection
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
performance
Performance
  • Tech Preview was interpreted
  • Machine code is generated (but not much)
  • 2 JITs (ARM & other), No NGEN
  • ARM is supposed to be twice as fast
  • UI is ~20% slower on device
  • Release builds are slower?
  • No profiling tools
    • Environment.TickCount
    • QueryPerformanceCounter
  • SP2 has some significant resource and xml handling speed ups
what is slow
What is slow
  • XmlDocument
  • Reflection
  • Catching Exceptions
  • pInvoke
  • DataSets
  • Web Services
  • Data Binding
what is faster
What is faster
  • XmlDocument – XmlTextReader / Writer
  • Reflection – pre generate code
  • Catching Exceptions – only exceptions
  • pInvoke – wrap into native thunk layer
  • DataSets – SQL CE
  • Web Services – call from a thread
  • Data Binding – bind manually
what is faster31
What is faster
  • SQL CE replication
  • Pre-init behind the scenes
  • Re-use objects
  • StringBuilder
  • Drawing controls top-down, parents 1st
  • Don’t overdesign
final thought
Final Thought
  • Stages of a Mobile Developer
    • I can’t do anything!
    • Nevermind, everything I need is here, I just need to do some work to access it.
    • Why is this so slow?
    • Maybe I should optimize my code …
  • Remember that these are resource constrained Devices!
  • Remember that these are resource constrained Devices!
futures
Futures
  • Smartphones
  • CF v2.0
  • SQL Mobile
  • Future Windows Mobile Platform
  • To watch
  • Predictions
smartphone
SmartPhone
  • 2002 OS does NOT support .NETcf
    • No future support announced by MS
  • 2003 Windows Mobile
    • 2nd edition release happening in US
    • will run CF v1 but not CF v2 (PPC will)
  • .NETcf is basically unchanged
    • Missing some UI controls
    • Missing SQL Server CE
    • 1-hand usage / no touch screen
cf v2 0
CF v2.0
  • eVC IDE integrated into VS .NET
    • Mixed native and managed debugging
    • Remote tools
    • Attach to running process
  • Language updates
    • Generics, Iterators, Anonymous methods
  • Performance
    • Execution engine, Unified JIT, profiling(?)
  • Interop
    • COM RCW, Marshalling, Runtime hosting(?)
cf v2 036
CF v2.0
  • 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
cf v2 037
CF v2.0
  • Emulator
    • ActiveSync, Shared Folder, Stateful, Orientations
  • Protocols
    • IPv6, Kerberos, NTLM, SOAP 1.2
  • XML
    • XPath(?), Schemas, Serialization
  • BCL
    • Image, Messaging, Registry, Cryptography, Serial, Sound
sql mobile
SQL Mobile
  • Multiple Connections
  • Improved Performance
  • Greatly Improved Tool Support
  • SqlCeResultSet
    • Bulk loads
    • Cursor
    • The desktop does not get this 
  • Runs on Tablet PCs too
  • Fixes 2.0 corruption bug
future windows mobile platform
Future Windows Mobile Platform
  • Enhanced services and device support
    • Mobile Outlook
    • SMS Messaging
    • Telephony
    • Notifications Broker
    • Location Services
    • Peripherals support
    • Device Configuration
    • Direct3D, DirectDraw
  • Distributed through SDKs
to watch
To watch
  • Portable Media Center
    • Has .NETcf v1.0 on it (closed)
  • SPOT watches
    • 384K RAM, ~1 meg flash, 27Mhz
    • OS = HAL + CLR
    • Only what is needed
    • Interpreted
  • .netcpu
    • For .NET embedded platforms
  • New form factors
    • Motorola MPx
  • Mappoint Location Services
  • WS Device Profile (UPnP 2.0)
predictions
Predictions
  • HREF EXEs (CAS?)
  • Car .NET
  • Longhorn
  • Modular
resources
Resources
  • Newsgroups (microsoft.public.)
    • dotnet.framework.compactframework
    • smartphone.developer
  • Portals
    • msdn.microsoft.com/smartclient/understanding/netcf/
    • pocketpcdn.com
    • devbuzz.com
    • codeproject.com/netcf/
    • microsoft.com/seminar/events/series/msdnmobility.mspx
    • brains-N-brawn.com/cfBCL/
  • Spelunking
    • Reflector, ILDasm
books
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) C# & VB
  • Building Solutions with the .NETcf (Addison) VB
  • .NET Compact Framework Programming (Addison) C# or VB