Quantcast
Channel: Notes from a dark corner
Viewing all 38 articles
Browse latest View live

How to figure out why your web application is running slow.

$
0
0

I came across this great “portal article” (by which I mean it has links to resources on a particular topic) about

Developer Tools & Platforms Performance

It starts of with a short plug for Microsoft advisory services but then moves onto a long list of self-help resources, including articles, blog posts and tools.

HTH

Doug


You spent HOW much on our new server and the app slowed DOWN??!!

$
0
0

I had a support case recently where the customer had moved their server farm onto brand new hardware, each server with lots of CPUs. At the same time they had taken the operating system from Windows Server 2003 to Windows Server 2008 R2. I forget how many CPUs they had but let’s just say that their task manager looked something like this:

image

(This is not a screenshot from my desktop machine at work I hasten to add. Oh, if only!)

They were understandably disappointed to find that a key web service had degraded from about 0.2ms to 0.4ms response time.

Now what they had noticed was that CPU#0 was getting more than its fair share of the work, peaking near 100% a lot of the time. The other curious thing they had found was that if they disabled CPU#0 for the w3wp.exe hosting the application while the process was running the problem resolved and performance increased.  [You can do this by right clicking on the process in the list on the processes tab in task manager and selecting “Set affinity”. This is something I would strongly recommend against doing in the normal course of events but in this case it was a useful diagnostic step].] But they also found that if they permanently disabled use of CPU#0 for that application pool by setting the processor affinity mask in the application pool advanced properties then the high CPU just shifted onto CPU#1.

The other thing that had been observed was that the performance counter for “.NET CLR Memory\%time in GC” was now around 40% whereas on the old servers it had been around 2%. Not good.

Anyway, in the end we got the debugger attached (of course!). Now the .NET Garbage Collector (GC), when running in server mode which is what ASP.NET uses on multi-processor machines, creates a dedicated thread per CPU.  As most real world applications tend to allocate objects quite liberally and leave them for the GC to clear up it is not that uncommon to see the GC threads at the top of the list in !runaway output. For example, on a 4 logical CPU machine it might look like this:

0:000> !runaway
User Mode Time
  Thread       Time
  26:56c       0 days 0:05:10.328
  38:488       0 days 0:05:10.750
  37:be4       0 days 0:05:07.328
  39:dc8       0 days 0:04:37.796
  48:acc       0 days 0:00:27.484
  31:1144      0 days 0:00:22.156

You can see the top 4 threads have used up considerably more user mode time than subsequent threads. This is normal and reasonable.

In my customer’s case however it looked more like this:

0:000> !runaway
User Mode Time
  Thread       Time
  26:56c       0 days 0:07:10.328
  38:488       0 days 0:00:10.750
  37:be4       0 days 0:00:07.328
  39:dc8       0 days 0:00:37.796
  48:acc       0 days 0:00:27.484
  31:1144      0 days 0:00:22.156
….

The top thread (which was indeed a GC thread) was chewing up much more time than any other.

This rang some bells at the back of my mind and I remembered this fix:

A hotfix is available that resolves the System.InsufficientMemoryException exception and enhances the heap balancing on a computer that has over 8 processors for the .NET Framework 2.0 Service Pack 2

Don’t be fooled by the title. If you look at the article you’ll see the hotfix release addresses two issues at the same time [hotfixes are cumulative so when you install a fix you are always getting lots of fixes anyway it is just that usually each hotfix release just adds one new fix to the mix]. Here is the description:

Issue 2

You run a .NET Framework 2.0-based application on a computer that has more than 8 logical processors. The computer uses the server garbage collector. In this case, you may experience a memory issue caused by an unbalanced workload in different processors. For example, the application runs slower than when you run the application on a computer that has 8 logical processors.

That certainly seemed to fit the bill.

We installed the fix on the customer’s server and the issue was resolved!

HTH

Doug

“System.Runtime.InteropServices.COMException (0x80070102): Operation failed” trying to send a Fax from an ASP.NET application

$
0
0

I recently had a support case where the customer was trying to send a fax from an ASP.NET application but was getting this error when they did:

System.Runtime.InteropServices.COMException (0x80070102): Operation failed

They got this error after a short delay after executing the fax code. They were trying to use FAXCOMEXLib with code similar to the example documented here. You can see from looking around the internet that other people have tried this and run into similar errors. For example this person also hit an InteropServices.COMException as well, albeit with an error code of 0x80070483. 

Errors of the form 0x8007xxxx indicate a Win32 error. A quick way to translate these is to take the last 4 digits, convert to decimal and plug into NET HELPMSG at a command prompt:

>net helpmsg 258
The wait operation timed out.

>net helpmsg 1155
No application is associated with the specified file for this operation.

Turns out the way that faxing works is it uses ShelExecute to launch the document you are trying to fax in whatever application is associated with the file extension for that document. The code initiating the fax waits for that shelled process to complete its job before continuing. In my customer’s case the error was indicating that never completed. In that other case I link to above it looks like no file association could be worked out for the document being faxed.

What you have to remember in this sort of scenario is that the process performing the faxing operation is not running like a normal user. By default it will be running under the NETWORK SERVICE account, although as part of trouble shooting my customer had tried running the application under various combinations of user account.

From looking at some memory dumps after the fax operation had been initiated we could see that the ShellExecute had been called, for a PDF document, and we were blocked waiting for the shelled process to complete – which in this case was Adobe Reader 9.0 (AcroRd32.exe). 

When we investigated with Process Monitor we noticed that AcroRd32.exe was launching correctly but then exiting very rapidly with an exit code of 1, indicating an error had occurred. Closer inspection showed that just prior to exiting it looked for this registry key and didn’t find it:

HKEY_LOCAL_MACHINE\.DEFAULT\Software\Adobe\Acrobat Reader\9.0\AdobeViewer

When I checked the same key (without the .DEFAULT) under my own HKEY_CURRENT_USER hive I could see this key would contain information such as whether the user had accepted the Adobe EULA etc.

The .DEFAULT key under HKLM is the hive that is used for system accounts like SYSTEM and NETWORK SERVICE.

I suggested that the customer configure the application pool to run with a specific local user account and that they actually log on locally with that account one time and run Adobe Reader (and accept any EULAs etc).

After doing that, it all worked.

HTH

Doug

“Script Error encountered", "'__doPostBack' is undefined” or MaintainScrollPositionOnPostBack fails to maintain the scroll position

$
0
0

 

You may receive this error in the browser using Internet Explorer 10:

“Script Error encountered", "'__doPostBack' is undefined”

Fixes are now available for Microsoft .NET Framework 3.51 (Windows 7 / Windows Server 2008 R2), Microsoft .NET Framework 4.0 and Microsoft .NET Framework 2.0 SP2:

http://support.microsoft.com/kb/2600088   (.NET Framework 4.0)          

http://support.microsoft.com/kb/2608565   (Win7/Server 2008 R2 )

http://support.microsoft.com/kb/2600100   (.NET Framework 2.0 SP2/.NET Framework 3.5 SP1)

In addition, the Microsoft .NET Framework 4.0 fix addresses an issue in which the browser’s scroll position is not maintained after a postback even though you’ve set the MaintainScrollPositionOnPostBack in your web application code.

To get the appropriate fix, go to the appropriate article and click the “Hotfix Download Available” graphic and follow the instructions:

image

HTH

Doug

Microsoft EMEA IIS/ASP.NET and web developer support team

$
0
0

I recently attended an offsite meeting in Munich for our Microsoft EMEA IIS/ASP.NET and web developer support team. It’s the first time we’ve had the chance to get together in one place for several years (even though we work together everyday!) and it was great to meet up. Not everyone could make it but here are the ones that could:

image

From left to right: Gabor, Daniel, Jose, Doug, Noam, Michel, Paul, Rainer, Ahmet, Sylvain, Finbar, Spike, Markus, Karl, Carmelo, Martin and Emmanuel. Also part of the team but unable to attend this time were: Andreas, Carlo, Alex, Rez, Ashish, Amol, Devendra, Prashant, Mert and Omnia. Also there but not in the picture was Benjamin (author of ‘Working with NHibernate 3.0’)

As a team we are active bloggers.

Emmanuel, Paul, Sylvain and Michel (the French team) blog together here.
I have my blog that you are reading now.
We also have blogs by Carlo, Finbar, Ahmet, Andreas, Spike, Amol, Ashish, Devendra, Ben and Daniel.

And although she has now left the team, I must of course mention Tess’ blog for great debugging tutorials and support stories.

And finally, our student intern in the UK this year Alex Oliver blogs,  tweets and maintains a multitude of web properties. Over at alexolivier.me he blogs on topics as contrasting and diverse as “Using the web farm framework behind a proxy” and then reports direct from the Children’s BAFTAs!

Bye for now

Doug

Script Browser and Script Analyzer

$
0
0

Microsoft has just released two new resources to ease IT Pros’ lives.

· Script Browser – IT Pros can search, download and manage 9000+ TechNet automation script samples covering almost all Microsoft IT products from within their scripting environment.  Script Browser even supports offline search so users can download all interesting scripts and search them when they do not have internet access.

· Script Analyzer – It automatically scan your automation script and provide suggestions to improve the script quality and readability.

The resources can be downloaded from the following link:

http://blogs.msdn.com/b/powershell/archive/2014/04/16/a-world-of-scripts-at-your-fingertips-introducing-script-browser.aspx

clip_image002

The teams developing these tools are committed to continuously adding new features and benefiting IT Pros’ work.   They have an ambitious roadmap.  If you love what you see in Script Browser & Script Analyzer, please recommend it to your friends and colleagues. If you encounter any problems or have any suggestions, please contact onescript@microsoft.com. Your precious opinions and comments are more than welcome.

Regards

Doug

TechEd 2014 is underway with LOTS of exciting new stuff announced!

$
0
0

TechEd North America 2014 is underway! You can find an overview of the announcements on Soma and Brian’s blogs. Below are some resources of particular interest to developers

News & Videos: Read exec announcements by S. Somasegar & Brian Harry. See the TechEd press release and watch the session videos.

Visual Studio 2013 Update 2: Download Visual Studio 2013.2 (also available on MSDN subscriber downloads). Read about the new features on VisualStudio.com, discuss on the Web Dev & Visual Studio Team blogs, and on Twitter & Facebook.

Hybrid Apps: Read about today’s Multi-Device Hybrid Apps Preview release, on the MSDN overview page (with FAQs & docs), and the MS Open Tech blog.

Next Generation of .NET: Learn what’s coming for .NET devs, with an overview on the .NET blog and ASP.NET details on Scott Hanselman’s blog. Download this week’s releases, including .NET 4.5.2, .NET Native DP2, and RyuJIT CTP4.

Office 365 APIs: Download the Office 365 API Tools. Learn more about the new .NET & JavaScript libraries & tooling on the Office Developer blog and Channel9.

Application Lifecycle Management: Read the news & docs about integrating with Visual Studio Online using a new API (also covered in Brian’s post). Download the latest releases, including the OpsHub VSO Migration Utility and Release Management for Visual Studio 2013 with Update 2. Check out the Engineering Stories about how we build software at Microsoft.

Feedback: You can give feedback via Connect (bugs), UserVoice (suggestions), MSDN Forums & StackOverflow (Q&A), Send-A-Smile in the IDE, or contact Product Support as appropriate.

Also there have been numerous announcements about Microsoft Azure. See this blog for more information.

HTH

Doug

Upcoming webinars from @WSDevSol

$
0
0

Some upcoming webinars, first one today! Brought to you by members of the Windows Store Developer Solutions team in Microsoft Customer Service and Support.

Debugging your Direct3D apps for Windows Phone 8.1

10 June, 16.00 London time

Rob Caplan and James Dailey, Microsoft               

http://forumnokia.adobeconnect.com/e5rrvxmhewt/event/registration.html

With the release of Windows Phone 8.1 the Visual Studio team has added advanced graphics debugging tools from Windows and Windows Store apps to Windows Phone 8.1. You can now inspect how each pixel your Direct3D scene has been created. This new tool is perfect for debugging complex shader bugs and strange performance issues in your app. In this session we will walk you through using these new graphics debugging tools. We will take you step by step and show you how to use the tools to debug issues with your shader. We will also show you techniques that you can use with these tools to track down and eliminate performance problems in your app.

Developing Universal Apps with Windows Azure Mobile Services

17 June, 16:00 London time

Matthew Small and Jeff Sanders, Microsoft

http://forumnokia.adobeconnect.com/e7ti5tc405l/event/registration.html

Universal Apps and Windows Azure Mobile Services are a perfect combination to create apps that connect to the same cloud data quickly and easily while sharing common code.  In this session will cover the basics of creating a Mobile Service locally using a .NET backend and debugging techniques.  We then will connect our Phone and Tablet to the Mobile Service and use shared code in Windows 8.1 Universal Apps utilizing MVVM techniques.

Optimizing Windows Phone Apps using Performance and Diagnostics Tools

24 June, 16:00 London time        

Bret Bentzinger and Prashant Phadke, Microsoft

http://forumnokia.adobeconnect.com/e9mdeuuilbg/event/registration.html

In this session we will show how to best utilize the Windows Phone API’s to minimize battery drain while utilizing the maximum benefits of having multiple cores on your Phone. We will use a sample application, along with the new Performance and Diagnostic tools, to illustrate the difference in battery consumption for a synchronous operation versus utilizing multiple CPU’s in an asynchronous operation.

HTH

Doug


PasswordVault.Add may fail on Windows 10

$
0
0

 

I am slightly embarrassed by the length of time since my last blog post. But never mind, here I am again!

I’ve been working on a customer issue lately where an existing Windows Store app was failing on Windows 10. Initially the app, which ran fine on Windows 8.1 was crashing when installed and run, unaltered, on Windows 10.  The code involved looked something like this:

           var vault = new PasswordVault();
         
           // Add the new credential
           var passwordCredential = new PasswordCredential(“test”, “user”, “password”);

         

           try
           {

               // *** This should not give an error ***
               vault.Add(passwordCredential);
               return “Successfully added credential!”;


           }
           catch (Exception excp)
           {
               return “Failed!” + excp.ToString();
           }

PasswordVault is a handy class that allows you to securely store credentials used by your Windows Store or Windows Phone 8.1 app.

The .NET exception thrown was System.ArgumentException with the text “The parameter is incorrect. Cannot add credential to Vault”.  Of course, without the exception handler the app was crashing. With the exception handler it was not crashing but the credentials were not stored either. Not very useful.

As is often the way when debugging, I started by getting the customer’s solution into a state where I could compile and debug it locally, eliminating dependencies I did not have or need.  At that point I could reproduce the issue.  Next step was to start from a blank solution and build it up, adding similar code to that used in the customer’s solution. Interestingly that did not fail! So there had to be some other factor.

Anyway, to cut a long story short, it turned out this is a corner case that depends on the full app names length.  As a result, this only affects a very small number of apps.  The good news is that we got a bug filed and a fix through the system which has now been released, as of yesterday’s cumulative update:

Cumulative Update for Windows 10: August 27, 2015 (KB3081448)

Hope that helps

Doug

Version history of the CLR 4.0

$
0
0

 

Following on from my “Version history of the CLR 2.0” post I’ve decided to start one for 4.0.

The below generally only refer to patches affecting core CLR files clr.dll, not the rest of the framework, although I meant mention one or two other fixes with affected DLLs noted.

The following version numbers refer to the final revision number part of the full file version number, in other words the xxxx bit of 4.0.30319.xxxx

LDR
Branch
GDR
Branch
Description
2073 1040 [ MS15-118 affecting ASP.NET files ]
2063 1036 [ MS15-101 affecting system.drawing.dll ]
2056 1031 [ MS15-048 affecting system.security.dll ]
2059 1034 [ MS15-044 affecting WPF files ]
2056 1031 [ MS15-041 affecting ASP.NET files ]
2049 1030 [ MS14-072 affecting system.runtime.remoting.dll ]
2045 1026 [ MS14-057 affecting system.dll ]
2045 1026 MS14-053
2008   Hotfix rollup 2828843 is available for the .NET Framework 4 on Windows XP SP3, Windows Server 2003 SP2, Windows Vista SP2, Windows Server 2008 SP2, Windows 7, Windows 7 SP1, Windows Server 2008 R2, or Windows Server 2008 R2 SP1
     
2004   Hotfix rollup 2803771 is available for the .NET Framework 4
2001 1001 MS13-004: Description of the security update for the .NET Framework 4 on Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7, and Windows Server 2008 R2: January 8, 2013
590   Hotfix Rollup KB2756195 is available for the .NET Framework 4 on Windows XP SP3, Windows Server 2003 SP2, Windows Vista SP2, Windows Server 2008 SP2, Windows 7, Windows 7 SP1, Windows Server 2008 R2, and Windows Server 2008 R2 SP1
586 296 MS12-074: Description of the security update for the .NET Framework 4 on Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7, and Windows Server 2008 R2: November 13, 2012
577   Hotfix Rollup 2733944 is available for the .NET Framework 4 on Windows XP SP3, Windows Server 2003 SP2, Windows Vista SP2, Windows Server 2008 SP2, Windows 7, Windows 7 SP1, Windows Server 2008 R2, and Windows Server 2008 R2 SP1
569   Hotfix Rollup 2714396 is available for the .NET Framework 4
559   FIX: Console.ReadLine method waits for input instead of returning a null value when the redirected standard input of an application is closed in the .NET Framework 4.0
551 276 2600211 Update 4.0.3 for Microsoft .NET Framework 4 – Runtime Update
544 269 MS12-035: Description of the security update for the .NET Framework 4 on Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7, and Windows Server 2008 R2: May 8, 2012
530 261 2600217 Reliability Update 2 for the .NET Framework 4
526   2640103 FIX: “Faulting module name: clr.dll” error message when you run a Microsoft .NET Framework 4-based application
500   2592573 “Positive number required” error when you use a .NET Framework 4-based application to deserialize a file
488 239 2572078 MS11-078: Description of the security update for .NET Framework 4: October 11, 2011
485   2563373 Application might crash and encounter a System.NullReferenceException exception in the .NET Framework 4 if the CorrelationManager.LogicalOperationStack property is used
476   2540745 FIX: High memory usage when the Thread.AllocateDataSlot method allocates data slots in the .NET Framework 4
468 237 2533523 Reliability Update 1 for the .NET Framework 4
461   2538717 FIX: Application may crash if the Localized property is set to True in a .NET Framework 4-based Windows Form application
454 235 2518870 MS11-044: Description of the security update for the .NET Framework 4 on Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7, and Windows Server 2008 R2: June 14, 2011
453   2511058 FIX: Full thread stack is committed unexpectedly when you start threads that are not created in CLR after you set the value of the disableCommitThreadStack element to 1 in the .NET Framework 4
450 233 2468871 Update for the .NET Framework 4
448   2509818 FIX: ICorDebug interface does not resolve the managed frames on all stacks for a mini-dump file in the .NET Framework 4
431 225 2446708 MS11-028: Description of the security update for the .NET Framework 4 on Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7, and Windows Server 2008 R2: April 12, 2011
404   2467309 FIX: The String.IndexOf method takes longer than expected to finish, and .NET Framework 4.0 performance decreases significantly
390   2260913 FIX: Updating the .NET Framework may fail and some files in the GAC may be deleted
372 208 2162169 A beta version of an update rollup package is available for the .NET Framework 4
315   982638 A hotfix rollup is available for the .NET Framework 4 to fix some known issues in the .NET Framework remoting
  1 .NET 4.0 RTM (web installer) (standalone installer)

Unable to build a simple Cordova app in Visual Studio? Here’s a possible fix…

$
0
0

It is not so often these days that support cases have a quick solution. With the wealth of forums and other channels for peer assistance, most straightforward issues get fixed before people call us. So it is a pleasant change when something turns out to be quickly fixable.

In this case, the customer was using the Apache Cordova tooling for Visual Studio. We’d confirmed they were using the latest version of this, which at the time was Update 6.

Even a simple app created from the provided template would not build.

The build log was showing this:

1>         npm ERR! code EJSONPARSE
1>         npm ERR! Failed to parse json
1>         npm ERR! Unexpected token ‘\u0000’ at 1:1
1>         npm ERR!          npm ERR! ^

 

With quick input from the our team in Redmond that work on this it was clear the customer’s NPM cache had somehow got corrupted.

Suggestion was to clear the cache, by shutting down Visual Studio and deleting the contents of “C:\Users\[USERNAME]\AppData\Roaming\npm-cache”.

Happily, this fixed it.

HTH

Doug

Red Hat Enterprise Linux in Azure Marketplace

$
0
0

Exciting announcements yesterday about the availability of Red Hat Enterprise Linux in Azure Marketplace.

Find out more about Red Hat solutions on Azure here.

/D

File version history for CLR 4.x

$
0
0

In the past I have maintained some blogs posts about version histories of the CLR 2.0 and CLR 4.0. People seem to have found those useful over the years but they have become quite tough to maintain. With that in mind, I’m drawing a line under those old posts for now and making a bit of a fresh start here, capturing some of the newer key versions of the CLR 4.x family that have shipped.  I’ll try to update over time.

Version number indicated refers to CLR.DLL. If there are patches of significant interest relating to other files I’ll note that in the ‘File’ column.

 

Version (xx) File Note
4.6.1590.0   .NET 4.6.2 (released on 20th July 2016)
https://www.microsoft.com/en-us/download/details.aspx?id=53344
4.6.1586.0   Windows 10 Anniversary Update build 14393.51 thru .187
4.6.1087.0   MS16-155 (KB3195388): https://support.microsoft.com/en-us/help/3195388
(thanks ‘TheDavester’!)
4.6.1081   May 2015 hotfix rollup (e.g. hotfix KB3154528) (thanks Andre!)
4.6.1080   Windows 10 build 10586.545
4.6.1073.0   MS16-035 for .NET 4.6 and .NET 4.6.1
https://support.microsoft.com/en-us/kb/3135997
4.6.1055.0   .NET 4.6.1 RTM
https://www.microsoft.com/en-us/download/details.aspx?id=49982
     
4.6.81.0   .NET 4.6 RTM
http://www.microsoft.com/en-us/download/details.aspx?id=48130
4.0.30319.36358   May 2016 hotfix rollup for 4.5, 4.5.1 and 4.5.2
https://support.microsoft.com/en-us/kb/3156984

(thanks Andre!)
4.0.30319.36346   hotfix rollup for 4.5.1 and 4.5.2
https://support.microsoft.com/en-us/kb/3139545

https://support.microsoft.com/en-us/kb/3139543 (Windows 8.1, 2012R2)
(thanks Andre!)
4.0.30319.34209   .NET 4.5.2
4.0.30319.34014   .NET 4.5.1 + something
4.0.30319.18444   .NET 4.5.1 + MS14-009 on VistaSP2, 2008sp2, Win7SP1, 2008R2sp1
     
     
     
     
     

 

 

Additional useful references

Introducing the .NET Framework Monthly Rollup

.NET Framework Monthly Rollups Explained

.NET Framework Monthly Rollup: October 2016

.NET Framework December Monthly Rollup is Now Available

 

Targeting Packs

Application Compatibility in the .NET Framework

.NET Framework downloads

How to: Determine Which .NET Framework Versions Are Installed

What’s new in .NET 4.6.2

What’s new in .NET 2015 (.NET 4.6 and .NET Core)

What’s new in the .NET Framework 4.5.2

What’s new in the .NET Framework 4.5.1

Clarification on the support life cycle for the .NET Framework 3.5, the .NET Framework 3.0, and the .NET Framework 2.0

HTH

Doug

Troubleshooting exceptions in a Windows Phone app

$
0
0

You know the situation – you develop and debug your app, all works well and you deploy it onto the phones of a few testers or friends. Then, you get reports of the app just disappearing.   An app crashing on a phone typically just looks like the app just disappearing and the tiled start screen showing up again.

If you are troubleshooting as a developer and you have the phone in front of you, connected to your PC, this is no problem. You can debug the app interactively from Visual Studio (and if you are debugging interactively you can even remotely capture a dump file and pull it back over the wire for later analysis at your leisure.

But what if you cannot get direct access to the phone all the time or debug interactively from Visual Studio?

Well, one option is to use the awesome utility Field Medic which you can install on the phone and use to collect diagnostic traces and information.

It has many uses but one thing it can do is capture crash dumps of crashing apps and also ETW traces originating from .NET/CLR telling you details of the crash.

Assuming you have a way to reproduce the app crashing on your phone, here is how to figure out why it is happening.

Launch Field Medic and select Advanced:

image

Tap on ‘Categories’ and deselect them all but select the ‘Performance_DotNetRT’ one:

image

This will capture Event Tracing for Windows (ETW) logs relevant to .NET/CLR.

Now if you also want to generate crash dumps for the issue (if you like delving into WinDBG) tap on ‘Choose your options’ under “Configure system log and crash dump options’:

image

Turn that on and select ‘Full’:

image

I won’t be going into the specifics of looking at the crash dumps in this blog post.

It is a good idea to minimise the number of apps running – just try to keep it to the app you are investigating. Traces are for the whole phone, not just your app.

Now back on the home page of Field Medic, tap on ‘Start Logging’ and you should see this after a moment or two:

image

 

Now reproduce the crash in your app, switch back to Field Medic (or re-launch it if it is no longer running) and select ‘Stop Logging’:

image

The ’Stop Logging’ phase may take a few extra seconds (sometimes quite a few!) if you have selected the Full Dump option.

You will be prompted to give your report a name and some contextual information:

image

Now connect your phone to your PC with and navigate to it in Windows Explorer:

image

If your phone was already connected to your PC, you may need to disconnect it and reconnect it before you see the new content on the phone file system. It seems to be a limitation of the USB based transport used to connect PC and phone that it does not auto-refresh. This was at least the case with Windows Phone 8.1 though it seems to be fixed in latest Windows 10 Mobile builds from what I can tell.

Navigate into the “This PC\Windows Phone\Phone\Documents\FieldMedic\reports” folder and copy the entire report folder off the phone. The report folders have names like this:

WPB_000_20160420_120713

Field Medic traces, among other things, captures Event Trace Log (ETL) files. There are various ways to read these specially formatted files but one of the most fast and convenient I find is the multi-talented PerfView.

Navigate into the report folder to locate the single ETL we collected:

image

and open it with PerfView.

Once in there, in the PerfView UI navigate to the ‘Events’ node under the node for the ETL:

image

 

This will open a new window for exploring the ETL contents

Now type ‘exception’ into the event types filter box and click update:

image

Hopefully you will now see a filtered list of events on the right. Note there may be some innocuous exception events going on from other apps that are not relevant.

In this example however we can see an entry from my app, which is called App2 (ok, so perhaps I am not cut out for marketing!)

If I click on that event and Ctrl+C here is what I get:

“HasStack=”True” ThreadID=”704″ ExceptionType=”System.NullReferenceException” ExceptionMessage=”Object reference not set to an instance of an object.” ExceptionEIP=”0x35f1d36″ ExceptionHRESULT=”-2,147,467,261″ ExceptionFlags=”CLSCompliant” ClrInstanceID=”10″ ”

If it is a complex app with other non-crashing exceptions going on you might need to look at whether that was the last event logged by that instance of App2 to know whether it was the exception that brought the process down or not.

In this case, we now know that at System.NullReferenceException killed the process at instruction pointer address 0x35f1d36. Hmm, interesting but maybe not useful, yet.

Note, however, the HasStack=”True” in the above. Sounds useful, right?

Close that PerfView window you’ve been working in and go back to the primary window. Navigate into the “Advanced Group” and double-click on ‘Exception Stacks’:

image

 

You’ll get a process selection window open – now double click on the entry for your app:

image

A new window will appear showing stacks for exceptions that happened within the App2 process during the trace. In this case there is only one and it is the exception we are interested in:

image

 

Thankfully, this time, it tells me the function in my app where the exception was thrown. That is enough of a clue to get me on the right track and figure out what went wrong.

If you need to go deeper and you selected the Full Dump option earlier, you will find the full memory dump in the Documents\Debug folder (on Windows Phone 8.1):

image

If you are looking for the dump file on Windows 10 Mobile, it seems things have changed slightly and Field Medic pulls the dump file out of the Documents\Debug folder and CABs it up with Watson telemetry data within the Field Medic report:

image

Of course, I could have instrumented my app with HockeyApp and got crash reports that way Smile.

Here are some additional references:

Use Field Medic to generate a report

Windows/Phone 8.1 Debugging: Getting a Crash Dump File From a Device

HTH

/D

Open the Visual Studio Output windows with the keyboard

$
0
0

I am not great with keyboard shortcuts. I use quite a few but my repertoire is a bit limited. One thing that frustrated me for a while though was the apparent lack of a shortcut to bring up the Output window in VS2015:

image

 

Anyway, turns out there is one – Ctrl+Alt+O

Of course, having figured that out, then I realised it also appears on the View menu (New Year’s Resolution – be more observant!) where it the shortcut is documented:

image

 

One small step for a developer….

 

Doug


GenGetProcessInfo.Start(0x1234) failed, 0x800700ea

$
0
0

This is rather obscure but seems to come up every so often.

Here 0x1234 would be the process ID of the process that we were attempting to dump. The Win32 error is 0x800700ea

The issue here was that one of my colleagues was having trouble generating a memory dump of a w3wp.exe hosting a particular web application. It kept failing with this error or some variant of it with just about any dump generating tool. Dumps of other web applications on the same machine were fine.

It turns out the root cause here was the full path of some temporary ASP.NET compiled module mapped into the process was too long and exceeded the system defined MAX_PATH.

The workaround is to configure ASP.NET to compile its temporary assemblies into some location with a shorter path by setting the tempDirectory attribute of the compilation element.

Thanks to Mourad and Joao for this one.

Doug

RSS and Atom feeds for support content

$
0
0

Thanks to a new service from our content team, you can now get an Atom or RSS feed for a wide variety of support content categories, e.g. .NET Framework, .NET Core, Visual Studio or many other Microsoft products. You'll receive notifications of both new content and content updates (big and small) into your reader or inbox of choice!

HTH

Doug

End of an era for this blog…

$
0
0

Dear readers

I've not blogged a lot in recent years but from tomorrow I will officially no longer blog here.  I've not decided whether, where or if I will blog in the future. Time will tell. For the time being, old posts should remain and will possibly end up in some future archive site. Looking back, my all time golden year in terms of sheer volume of blog posts was 2008 with 70 posts.

From my initial post about "Why my corner is dark" (I am no longer in that corner and my present desk is not dark), on to my first enthusiastic and ambitious deep dive technical post about how to "Determine the origin of a static root", I meandered through a variety of technical and non-technical posts. Here are some of my popular and favourite ones:

 

At the time of writing this post I can still be found on Twitter as @dougste and also on LinkedIn.  If I do resume blogging in the future I will link to my new blog from those profiles.

Goodbye for now and thanks for reading! I hope it helped.

Doug

Viewing all 38 articles
Browse latest View live