+ All Categories
Home > Documents > Compact Framework .NETcf : from the trenches

Compact Framework .NETcf : from the trenches

Date post: 11-Jan-2016
Category:
Upload: aelan
View: 34 times
Download: 1 times
Share this document with a friend
Description:
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. - PowerPoint PPT Presentation
Popular Tags:
41
1 Compact Framework .NETcf : from the trenches casey chesnut brains-N-brawn.com 12/15/2003 Harvard for David Platt’s .NET class
Transcript
Page 1: Compact Framework .NETcf : from the trenches

1

Compact Framework.NETcf : from the trenches

casey chesnut

brains-N-brawn.com

12/15/2003

Harvard

for David Platt’s .NET class

Page 2: Compact Framework .NETcf : from the trenches

2

Questions

Language– C#, VB .NET, C++, Java

At work– .NET, .NETcf

CE

Page 3: Compact Framework .NETcf : from the trenches

3

Experience

Web Services Compact Framework Tablet PC Speech .NET

Page 4: Compact Framework .NETcf : from the trenches

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

Page 5: Compact Framework .NETcf : from the trenches

5

Agenda

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

Page 6: Compact Framework .NETcf : from the trenches

6

What Is Missing

Assemblies Namespaces Types Events Properties Methods Overloads Behavior

Page 7: Compact Framework .NETcf : from the trenches

.NETfx versus .NETcf.NETfx versus .NETcf

SystemSystem

System.DataSystem.Data System.XmlSystem.Xml

System.WebSystem.Web

GlobalizationGlobalization

TextText

* Security* Security

CollectionsCollections

ResourcesResources

ReflectionReflection

NetNet

IOIO

* Threading* Threading

* Diagnostics* Diagnostics

ServiceProcessServiceProcess

ConfigurationConfiguration

DesignDesign

ADO.NETADO.NET

SqlServerCeSqlServerCe

SqlClientSqlClient

Xslt/XPathXslt/XPath

XmlDocumentXmlDocument

RuntimeRuntimeInteropServicesInteropServices

RemotingRemoting

SerializationSerialization

SerializationSerialization

ConfigurationConfiguration SessionStateSessionState

CachingCaching SecuritySecurity

ServicesServicesDescriptionDescription

DiscoveryDiscovery

ProtocolsProtocols

UIUIHtmlControlsHtmlControls

WebControlsWebControls

System.DrawingSystem.Drawing

ImagingImaging

Drawing2DDrawing2D

TextText

PrintingPrinting

System.WinFormsSystem.WinForms

DesignDesign ComponentModelComponentModel

Reader/WritersReader/Writers

Page 8: Compact Framework .NETcf : from the trenches

8

Metrics

.NETfx Types: 4,753 Methods: 80,277

.NETcf Types: 1,360 Methods: 18,701

* mscorlib, system, system.data, system.drawing, system.windows.forms, system.xml

* .NETcf adds SqlCe and IRDA namespaces

Page 9: Compact Framework .NETcf : from the trenches

9

Examples

Typed DataSets (.xsd) Resource files (.resx) Hardcoded strings

– Registry keys– Environment variables– File paths

Types– Sealed– Partial implementations

Page 10: Compact Framework .NETcf : from the trenches

10

Examples

pInvoke– Unicode– MarshalAs– FieldOffset– Missing or different DLLs

Missing or different OS features– WMI– Hosts

Updating controls from thread Bugs

Page 11: Compact Framework .NETcf : from the trenches

11

How To Get It Back

Open source efforts 3rd party controls pInvoke

– CE .NET Win32 APIs– eVC++ thunk layer

Write the logic yourself

Page 12: Compact Framework .NETcf : from the trenches

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

Page 13: Compact Framework .NETcf : from the trenches

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

Page 14: Compact Framework .NETcf : from the trenches

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

Page 15: Compact Framework .NETcf : from the trenches

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

Page 16: Compact Framework .NETcf : from the trenches

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

Page 17: Compact Framework .NETcf : from the trenches

17

Write it yourself

Page 18: Compact Framework .NETcf : from the trenches

.NETcf extended.NETcf extended

SystemSystem

System.DataSystem.Data System.XmlSystem.Xml

System.WebSystem.Web

GlobalizationGlobalization

TextText

* Security* Security

CollectionsCollections

ResourcesResources

ReflectionReflection

NetNet

IOIO

* Threading* Threading

* Diagnostics* Diagnostics

ServiceProcessServiceProcess

ConfigurationConfiguration

DesignDesign

ADO.NETADO.NET

SqlServerCeSqlServerCe

SqlClientSqlClient

Xslt/XPathXslt/XPath

XmlDocumentXmlDocument

RuntimeRuntimeInteropServicesInteropServices

SerializationSerialization

SerializationSerialization

ConfigurationConfiguration SessionStateSessionState

CachingCaching SecuritySecurity

ServicesServicesDescriptionDescription

DiscoveryDiscovery

ProtocolsProtocols

UIUIHtmlControlsHtmlControls

WebControlsWebControls

System.DrawingSystem.Drawing

ImagingImaging

Drawing2DDrawing2D

TextText

PrintingPrinting

System.WinFormsSystem.WinForms

DesignDesign ComponentModelComponentModel

Reader/WritersReader/Writers

RemotingRemoting

Page 19: Compact Framework .NETcf : from the trenches

19

Where We Are Now

Page 20: Compact Framework .NETcf : from the trenches

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

Page 21: Compact Framework .NETcf : from the trenches

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

Page 22: Compact Framework .NETcf : from the trenches

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

Page 23: Compact Framework .NETcf : from the trenches

23

pInvoke Debugging

Cross platform pInvoke signatures SetLastError, Marshal.GetLastWin32Error Exceptions

– NotSupportedException– MissingMethodException

Look at .h files dumpbin /exports (name mangling) P/Invoke Wizard

Page 24: Compact Framework .NETcf : from the trenches

24

Data

Web Services XML DB API Pocket Access CSV 3rd party SQL

Page 25: Compact Framework .NETcf : from the trenches

25

SQL

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

Page 26: Compact Framework .NETcf : from the trenches

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

Page 27: Compact Framework .NETcf : from the trenches

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

Page 28: Compact Framework .NETcf : from the trenches

28

What is slow

XmlDocument Reflection Catching Exceptions pInvoke DataSets Web Services Data Binding

Page 29: Compact Framework .NETcf : from the trenches

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

Page 30: Compact Framework .NETcf : from the trenches

30

Final Thought

Remember that these are Embedded Devices!

Page 31: Compact Framework .NETcf : from the trenches

31

Futures

SmartPhone 2003 Whidbey (.NETcf) Predictions

Page 32: Compact Framework .NETcf : from the trenches

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

Page 33: Compact Framework .NETcf : from the trenches

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

Page 34: Compact Framework .NETcf : from the trenches

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

Page 35: Compact Framework .NETcf : from the trenches

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

Page 36: Compact Framework .NETcf : from the trenches

36

Whidbey

Direct3D, DirectDraw Notifications of system state POOM Telephony Device Configuration Location Services

Page 37: Compact Framework .NETcf : from the trenches

37

Predictions

HREF EXEs (CAS?) SPOT

– 384K RAM, ~1 meg flash, 27Mhz– OS = HAL + CLR– Only what is needed– Interpreted

Car .NET Longhorn Modular

Page 38: Compact Framework .NETcf : from the trenches

38

Resources

Newsgroups (microsoft.public.)– dotnet.framework.compactframework– smartphone.developer

Source– OpenNetCF.org, go-mono.org, ssCli / Rotor

Spelunking– Reflector, Anakrino, ILDasm

Page 39: Compact Framework .NETcf : from the trenches

39

Portals

microsoftdev.com MS .NETcf FAQ devbuzz.com pocketpcdn.com dotnetdn.com

Page 40: Compact Framework .NETcf : from the trenches

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

Page 41: Compact Framework .NETcf : from the trenches

41

Questions


Recommended