/
Andrew Richards	Maarten van de Bospoort Andrew Richards	Maarten van de Bospoort

Andrew Richards Maarten van de Bospoort - PowerPoint Presentation

tatiana-dople
tatiana-dople . @tatiana-dople
Follow
411 views
Uploaded On 2016-05-02

Andrew Richards Maarten van de Bospoort - PPT Presentation

Senior SDE Principal Consultant Platform Health Premier Services for Developers Avoiding Windows Store App Failures Crashes and Hangs 3657 Deep dive in WinRT API Focus on nonUI aspect ID: 302828

windows exception stowed 004 exception windows 004 stowed microsoft null widget system clr information foo store combase pde 0180cf90 catch xaml taskinstance

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Andrew Richards Maarten van de Bospoort" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1
Slide2

Andrew Richards Maarten van de BospoortSenior SDE Principal ConsultantPlatform Health Premier Services for Developers

Avoiding Windows Store App Failures(Crashes and Hangs)

3-657Slide3

Deep dive in WinRT APIFocus on non-UI aspectCo-author with Jeffrey Richter

Windows Runtime via C#Slide4

Premier Support for Developers

Proactive ServicesSoftware solutions delivered as a strategic asset

Assistance for each phase in development cycle

Experts in Development

Support delivery from deep within Microsoft

Onsite and remote assistance, guidance, and services

Comprehensive Services Suite

Targeted, standard, and customizable offerings

Empower your teams through knowledge transfer

Strategic access to support and development guidance direct from the source

CTS

Field Engineers

ADMs

Product Teams

Business

goal aligned service delivery

Best Practices &

Expert Guidance

Service

Delivery Planning

http://aka.ms/qgm2kg

Slide5

New episode every Monday @ 9am80+ episodesCovered topics include:

SysinternalsDebugging Tools for WindowsWindows Performance ToolkitWindows Internals

CLR Internals

… and much, much more …

Channel 9 – Defrag ToolsSlide6

Getting your failuresDebugging your failuresCommon mistakes

AgendaSlide7

Key LearningsUnderstand the app’s quality

Learn how to debug your issuesReview your code for common mistakesSlide8

Getting your failuresSlide9

Dev Center – Windows Store appshttps://appdev.microsoft.com/StorePortals

Dev Center – Windows Phone appshttps

://

dev.windowsphone.com/dashboard

DashboardSlide10

ReportsJavaScript exception rateCrash rate

App unresponsive rateWindows Store AppsSlide11

Reports

Crash rate

Windows Phone AppsSlide12

Debugging your failuresSlide13

Improving apps with Quality reportsApplies to Windows 8.0

Windows Store for Developers blogSlide14

Debugging a Windows 8.1 Store App Crash Dump

Stowed Exceptions v1Applies

to Windows

8.1 (up to March 2014)

NT Debugging BlogSlide15

PDE Debugger ExtensionStowed Exceptions v1 & v2

Applies to Windows 8.1

PDE Debugger ExtensionSlide16

0:004> .sympath SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols

Symbol search path is: SRV*C:\Symbols*http://msdl.microsoft.com/download/symbolsExpanded Symbol search path is: srv

*c:\Symbols*http://msdl.microsoft.com/download/symbols

...

 

0:004> .reload /f...

0:004

>

.ecxreax=00000001 ebx=

ffffffff ecx=00000005 edx=0a6ee048 esi=13672424 edi=0546c33ceip=722248e8 esp=02ceeef8 ebp=02ceef14 iopl=0         nv up ei

pl nz

na po

nccs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00000202msvcr110!Concurrency::details::_ReportUnobservedException+0x22:722248e8 cd29            int    

29hDebugging Tools for WindowsSlide17

0:004> .exr -1

ExceptionAddress: 722248e8 (msvcr110!Concurrency::details::_ReportUnobservedException+0x00000022)   ExceptionCode

:

c0000409

(Security check failure or stack buffer overrun)

  ExceptionFlags: 00000001NumberParameters: 1

 

Parameter[0]: 000000050:004> !error c0000409Error code: (NTSTATUS) 0xc0000409 (3221226505) - The system detected an overrun of a stack-based buffer in this application. This overrun could potentially allow a malicious user to gain control of this application

.Displaying the Exception Record (.exr)Slide18

0:004> .exr -1

ExceptionAddress: 73034fec (Windows_UI_Xaml!DirectUI::ErrorHelper

::ProcessUnhandledError+0x000000b8)

  

ExceptionCode

: c000027b  ExceptionFlags: 00000001

NumberParameters

: 2

   Parameter[0]: 0bdaf240   Parameter[1]: 000000010:006>

!error c000027bError code: (NTSTATUS) 0xc000027b (3221226107) - An application-internal exception has occurred.Stowed Exception – 0xC000027BSlide19

0:004> dt

0180cf90 combase!_STOWED_EXCEPTION_INFORMATION_HEADER*0x070884a4

   +0x000 Size             : 0x20

   +0x004 Signature        :

0x53453031

0:006> .formats

0x53453031

Evaluate expression:

  Hex:     53453031  Decimal: 1397043249  Octal:   12321230061  Binary:  01010011 01000101 00110000 00110001  Chars:  

SE01  Time:    Wed Apr 09 04:34:09 2014  Float:   low 8.46917e+011 high 0  Double:  6.90231e-315Stowed Exception HeaderSlide20

0:004> .exr -1

ExceptionAddress: 73034fec (Windows_UI_Xaml!DirectUI::ErrorHelper

::ProcessUnhandledError+0x000000b8)

  

ExceptionCode

: c000027b  ExceptionFlags: 00000001NumberParameters

: 2

   Parameter[0]:

0180cf90   Parameter[1]: 00000003//

SE01  V10:004> dt -a3 0180cf90 combase!_STOWED_EXCEPTION_INFORMATION_V1*...

// SE02

 V20:004

> dt -a3 0180cf90 combase!_STOWED_EXCEPTION_INFORMATION_V2*...Displaying a Stowed Exception

ArraySlide21

0:004> dt -a

3 0180cf90 combase!_STOWED_EXCEPTION_INFORMATION_

V1

*

[0] @ 0180cf90

---------------------------------------------0x070884a4

...

   +0x008

ResultCode       : 80131500...[1] @ 0180cf94 ---------------------------------------------

0x071ca274 ...   +0x008 ResultCode       : 80131534...[2] @ 0180cf98 ---------------------------------------------...Displaying a Stowed Exception Array (SE01)Slide22

0:004> dt -a

3 0180cf90 combase!_STOWED_EXCEPTION_INFORMATION_V1*

   +0x00c

ExceptionForm

    : 0y01   +0x014 StackTraceWordSize

: 4

   +0x018

StackTraceWords  : 5   +0x01c StackTrace       : 0x06f48418

Void…0:007> dpS 0x06f48418 L57723f217 combase!RoOriginateLanguageException+0x3b72e29bfd clr!SetupErrorInfo+0x1e172ef27e1 clr!MarshalNative::GetHRForException_WinRT+0x7d

71981170 Windows_UI_Xaml_ni+0x291170

72b02a36 clr!COMToCLRDispatchHelper+0x28

Displaying a Call Stack (Exception Form: 0y01)Slide23

0:005> dt -a6 13f117e0 combase!_STOWED_EXCEPTION_INFORMATION_V1*

…   +

0x00c

ExceptionForm

:

0y10   +0x010 ErrorText :

0x0de38f7c

0:005> du 0x0de38f7c 0de38f7c "System.Exception

.. at Windows."0de38fbc "UI.Xaml.VisualStateManager.GoToS"0de38ffc "tate(Control control, String sta"0de3903c "teName, Boolean useTransitions)."0de3907c ". at ExampleApp2.Common.Layout

"0de390bc "AwarePage.InvalidateVisualState

("0de390fc ").. at ExampleApp2.Common.Layo

"0de3913c "utAwarePage.WindowSizeChanged(Ob"0de3917c "ject sender, WindowSizeChangedEv"0de391bc "entArgs e)"

Displaying Error Text (Exception Form: 0y10)Slide24

0:006> !pde.dse

Stowed Exception Array @ 0x0076e5c0Stowed Exception #1

@ 0x063033ec

0x80004001 (FACILITY_NULL - Default): E_NOTIMPL - Not implemented

Stack : 0x4b91e08

7754bca2 combase!RoOriginateLanguageException+0x3b

61c69c5d clr!SetupErrorInfo+0x1e1

61d32a25

clr!MarshalNative::GetHRForException_WinRT+0x7d 6166a3c4 Windows_UI_Xaml_ni!DomainNeutralILStubClass.IL_STUB_... 61942a79 clr!COMToCLRDispatchHelper+0x6b

619d82e2 clr!COMToCLRWorker+0x3e6PDE Debugger Extension - !pde.dseSlide25

...>>> Last CLR Exception matches HRESULT <<<

Exception object: 0000003fa2be4830Exception type: System.NullReferenceException

Message: Object reference not set to an instance of an object.

InnerException

: <none>

StackTrace (generated): SP IP Function

0000003FBC80D190 00007FFB1F72FC18

TechReadyTV!TechReady16.Utilities.Authen…

0000003FBC80D1D0 00007FFB1F72FAC2 TechReadyTV!TechReady16.MainPage.MainPage… 0000003FBC80D210 00007FFB1F72F5E5

TechReadyTV!TechReady16.MainPage…...!pde.dse – Stowed Exception v1Slide26

...>>> Associated CLR Exception <<<

Exception object: 01e97288Exception type: System.NotImplementedException

Message: The method or operation is not implemented.

InnerException

: <none>

StackTrace (generated): SP IP Function

046EE7E4 70A5B625

CrashStore_ni!CrashStore.MainPage.Load_Click_1(…

StackTraceString: <none>HResult: 80004001

!pde.dse – Stowed Exception v2Slide27

Demo“WinDBG”Slide28

Windows Store App failuresSlide29

StatisticsSlide30

CLR ExceptionsSlide31

Common mistakesSlide32

System.NullReferenceExceptionSystem.ArgumentExceptionSystem.ArgumentNullException

NULL ReferencesSlide33

FROM:DisplayWidget(

foo.GetFirstWidget());TO:// Avoid

System.NullReferenceException

if (foo != null)

{

DisplayWidget(foo.GetFirstWidget

()

);

}NULL References – Function CallsSlide34

FROM:DisplayWidget(foo.GetFirstWidget

());TO:if (foo != null)

{

Widget

widget

= foo.GetFirstWidget(); if (widget != null) { // Avoid

System.ArgumentException

// Avoid

System.ArgumentNullException DisplayWidget(widget); }}

NULL References - ArgumentsSlide35

FROM:List<Widget> widgets = foo.GetWidgets

();foreach (Widget widget in

widgets)

{

... }

TO:List<Widget> widgets = foo.GetWidgets

();

if (widgets != null)

{ foreach (Widget widget in widgets) { ... }

}NULL References – IEnumerable & LINQSlide36

Missing try-catch blocksXML ParsingHTTP ResponseFile I/O

UnhandledExceptionsSlide37

try{

DoSomething();}catch (

System.UnauthorizedAccessException

uae

){ ...}

catch (

System.Exception

ex){ ...}Try - CatchSlide38

Demo“Windows Runtime XML data API”Scenario #3 (DTD)Slide39

Complete the DeferralAdd a Cancellation HandlerClose the Page (JavaScript)

Background Task (Hangs)Slide40

FROM

public sealed

class

SampleBackgroundTask :

IBackgroundTask

{

public

async void Run(IBackgroundTaskInstance taskInstance

)

{

try{ var deferral = taskInstance.GetDeferral

(); await DoSomethingAsync(); deferral.Complete();

} catch(..){ }

}}Background TasksSlide41

To

public sealed

class

SampleBackgroundTask :

IBackgroundTask

{

public

async void Run(IBackgroundTaskInstance taskInstance){

try

{

taskInstance.Canceled += new

BackgroundTaskCanceledEventHandler(OnCanceled);

var deferral = taskInstance.GetDeferral(); await

DoSomethingAsync(); } catch(..){…}

finally

{ deferral.Complete(); }

}}Background TasksSlide42

Demo“Background task sample”Slide43

Only Simple Types are supportedCrash is reported as XAML’s faultHappens at Suspend

Frame.Get NavigationStateSlide44

private

void

navigationHelper_SaveState

(

object

sender,

SaveStateEventArgs e)

{ if (this.itemsViewSource.View != null

)

{

var selectedItem =

(Data.SampleDataItem)this.itemsViewSource.View.CurrentItem;

if (selectedItem != null)

e.PageState["SelectedItem"] = selectedItem.UniqueId

;

int[] a5 = new int[5]; e.PageState[

"SomeData"] = a5; }}Frame.GetNavigationStateSlide45

Demo“Frame.GetNavigationState”Slide46

Improving apps with Quality reportshttp://aka.ms/iawq

Debugging a Windows 8.1 Store App Crash Dumphttp://aka.ms/dwsa

Understanding

and resolving failures in Windows Store

apps

http://aka.ms/urfwsa

ResourcesSlide47

Channel 9 – Defrag Toolshttp://channel9.msdn.com/Shows/Defrag-Tools

Windows Runtime via C#http://aka.ms/wrtcs

Premier Support for Developers

http

://

microsoftpremiersupport.com/developers

ResourcesSlide48

Your Feedback is Important

Fill out an evaluation of this session

and help shape future events.

Scan the QR code

to evaluate

this session on your mobile device.

You’ll also be entered into

a daily prize drawing!Slide49

©

2014

Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.