FUNL02 Lap Around the WinFX and Windows SDK

Download Report

Transcript FUNL02 Lap Around the WinFX and Windows SDK

FUNL02
Lap Around The
WinFX And Windows SDKs
Brent Rector
Program Manager
Microsoft Corporation
1
Agenda
Introduction to the Windows SDK
Breadth of new APIs
Development and debugging tools
Comand Shell
Performance Analysis Tools
2
The WinFX SDK
Contains documentation, samples, tools and
build environments for the WinFX programming
model
Ships with each WinFX CTP and Windows Vista
pre-release
WinFX is rapidly evolving
.NET Framework 2.0
Windows Presentation Foundation (Avalon)
Windows Communication Foundation (Indigo)
More to be announced…
Will be released concurrently with Windows Vista
WinFX Runtime Components for Windows XP and Windows
2003 Server
3
The Windows SDK
The Windows SDK is the SDK for
developing Windows applications
Contains documentation for all APIs,
interfaces, types, etc. found in the Windows
operating system
Also contains samples, tools and build
environments
The Windows SDK includes all the content you
would previously have found in the Platform SDK
Typically unmanaged APIs, samples and tools
The Windows SDK also contains the WinFX
SDK
4
APIs New To Vista
~ 4,000 new unmanaged APIs in Beta 1
~ 1,400 additional new APIs so far in Beta 2
Many more are coming…
Application Quality
Collaboration
Communication Infrastructure
Data Servers
700
File System
Gaming
Graphics
Installation and Update
Manageability
Media
600
500
Mobile
New Visuals
Presentation Infrastructure
Search and Organize
Secure Applications
400
300
200
Shell
System Internals
Tablet
Tools
Web Services
100
0
Technolgies
5
WinFX RC changes
Types
12000
10000
8000
6000
4000
2000
0
.NET 1.0
.NET 1.1
.NET 2.0
WinFX
Namespaces
300
250
200
150
100
50
0
.NET 1.0
.NET 1.1
.NET 2.0
WinFX
M embers
100000
90000
80000
70000
60000
50000
40000
30000
20000
10000
0
.NET 1.0
.NET 1.1
.NET 2.0
WinFX
6
XML Tools, Debug Tools
XSD.exe
XML Serializer
Mdbg.exe
FusLogVw.exe
7
Reading and Writing Xml
Lots of squirrelly brackets
Lots of approaches
strtok, printf, XmlReader, XmlWriter
Xsd.exe with XML Serializer – my favorite
Schema
Document
Class
Object
8
Xsd.exe
XML schema – class generator
XML schema -> .NET class
xsd <schema>.xsd /classes|dataset [/e:] [/l:] [/n:] [/o:] [/s] [/uri:]
.NET class -> XML Schema
xsd <assembly>.dll|.exe [/outputdir:] [/type: [...]]
XML document -> Inferred schema
xsd <instance>.xml [/outputdir:]
XDR schema -> XSD schema
xsd <schema>.xdr [/outputdir:]
9
Xsd.exe
10
Xml Serialization
The good, the bad, and the ugly
Good - Easy to use
Bad – Maybe not as efficient as assumed
Ugly – Details to follow
Finally, the attractive swan
11
Xml Serialization
Two XML serializable classes
public class Person {
private int m_age;
private string m_name;
private Pet m_pet;
public string Name {
get { return m_name; }
set { m_name = value; }
}
public int Age {
get { return m_age; }
set { m_age = value; }
}
public Pet Pet {
get {
return m_pet;
}
set {
m_pet = value;
}
}
}
public class Pet {
private System.DateTime m_birthDate;
private string m_name;
public string Name {
get { return m_name; }
set { m_name = value; }
}
public System.DateTime BirthDate {
get { return m_birthDate; }
set {m_birthDate = value; }
}
}
12
Xml Serialization
Easy to use
using System.Xml.Serialization;
static class App {
static void Main () {
XmlSerializer xs1 = new XmlSerializer (typeof (Person));
XmlSerializer xs2 = new XmlSerializer (typeof (Pet));
. . .
}
}
13
XmlSerializer
14
Xml Serialization
Not as performant as you might expect
Four assembly probe failures
Two in-memory compiles
Two assembly loads
15
Mdbg
16
Xml Serialization
Details
MSH> Mdbg
MDbg (Managed debugger) v2.0.50215.322 (beta2PLUS.050215-3200) started.
Copyright (C) Microsoft Corporation. All rights reserved.
For information about commands type "help";
to exit program type "quit".
mdbg> ca ml
mdbg> ca lm
mdbg> run XmlTest.exe
STOP: Module loaded: D:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll
STOP: Module loaded: D:\Users\BrentRe\Documents\PDCDemo\XmlTest.exe
STOP: Module loaded: D:\Users\BrentRe\Documents\PDCDemo\Person.DLL
STOP: Module loaded: D:\Users\BrentRe\Documents\PDCDemo\Pet.DLL
STOP: Module loaded: D:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll
STOP: Module loaded: D:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll
STOP: Module loaded: D:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll
STOP: MDANotification
Name=BindingFailure
XML=<mda:msg xmlns:mda="http://schemas.microsoft.com/CLR/2004/10/mda">
<!-- An assembly failed to load, returning HRESULT 0x80070002. It would have had
display name 'Person.XmlSerializers', been loaded from code base '' in binding
context 1 of the AppDomain with ID 1.
See D:\Windows\Microsoft.NET\Framework\v2.0.50215\sdk\bin\mdaBoilerplate.exe.mda.config for documentation.
-->
<mda:bindingFailureMsg break="true">
<assemblyInfo appDomainId="1" displayName="Person.XmlSerializers" codeBase="" hResult="-2147024894" bindingContextId="1"/>
</mda:bindingFailureMsg>
</mda:msg>
[p#:0, t#:0] mdbg>
17
Fusion Log Viewer
Fusion is the name of the assembly
binding component in the OS
Fusion log viewer displays attempts made
by Fusion to find a managed assembly
FusLogVw.exe tips
Run it, enable logging, shut it down, restart it
Clear the Internet Explorer cache
18
Fusion Log Viewer (FusLogVw)
19
Fusion Log Viewer
FusLogVw.exe
20
Sample Fusion Log
*** Assembly Binder Log Entry
(8/12/2005 @ 11:29:57 AM) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50215\mscorwks.dll
Running under executable D:\Temp\MyClient.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = REDMOND\brentre
LOG: DisplayName = Person.XmlSerializers, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null,
processorArchitecture=MSIL
(Fully-specified)
LOG: Appbase = file:///D:/Temp/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MyClient.exe
Calling assembly : System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
===
LOG: This bind is in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50215\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based
assembly bind).
LOG: Attempting download of new URL file:///D:/Temp/Person.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///D:/Temp/Person.XmlSerializers/Person.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///D:/Temp/Person.XmlSerializers.EXE.
LOG: Attempting download of new URL file:///D:/Temp/Person.XmlSerializers/Person.XmlSerializers.EXE.
LOG: All probing URLs attempted and failed.
21
Xml Serialization
Easy to improve
Sgen.exe
The Xml Serialization Proxy Generator
SGen /a:Person.dll /r:Pet.dll [/debug] [/keep]
Creates an assembly that contains classes
that can serialize specified classes as
XML
No need to compile against this assembly
Dynamically loaded as needed
22
Xml Serialization
Easy to improve
XmlSerializer tries to load an assembly
that contains a type that can serialize the
specified class
Will generate and compile source code for
such an assembly at runtime when one
cannot be loaded
Why not generate and compile this source
code during development?
23
Xml Serialization
Easy to improve
Sgen.exe
The Xml Serialization Proxy Generator
SGen /a:Person.dll /r:Pet.dll [/debug] [/keep]
24
Serialization Assembly
Generator (Sgen)
25
Build Tools
MSBuild
An XML-based managed code build tool
Items, Properties, Tasks, Targets
VCBuild
An XML-based unmanaged C++ build tool
NMake
A standard Makefile processing tool
26
Command Shells
CMD.EXE
Old, familiar, batch file command shell
MSH.EXE
New, unfamilar, shell script command shell
27
Microsoft Command Shell
28
WPF UI Tools
Xamlpad.exe
Enter XAML, see how it renders immediately
Perforator
Visual display of rendering requirements
UISpy.exe
Spy++ for XAML
Planned for WinFX SDK Beta 2
29
XamPad
30
Perforator
31
Interesting Samples
WPF Sample Gallery
MSBuild Project File Generator
SdkDiff
32
Summary
Visual Studio 2005 is best for
daily development
Common line development environment
still very useful
SDK has lots of sample code
> 700 samples in the Windows SDK
SDK is the ultimate documentation source
33
Contact Information
[email protected]
Track Lounge
Tuesday, Sept 13 – 14:15 to 17:30
Thursday, Sept 15 – 15:15 to 18:30
34
© 2005 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
35