windows-8.1,stack-trace,etw,wpr , Activate Stacks only for some specific ETW Tasks in a provider?

Activate Stacks only for some specific ETW Tasks in a provider?


Tag: windows-8.1,stack-trace,etw,wpr

Since Windows 7 it is possible to activate callstacks for usermode events. This works fine, but sometimes activating stacks for all tasks/Events in a provider is not needed and it would be nice to only activate stacks for some specific Tasks. Is this possible?


Yes, this is possible since Windows 8.1 with the type entry in _EVENT_FILTER_DESCRIPTOR when it is set to EVENT_FILTER_TYPE_STACKWALK when you call EnableTraceEx2.

On Windows 8.1,Windows Server 2012 R2, and later, event payload, scope, and stack walk filters can be used by the EnableTraceEx2 function and the ENABLE_TRACE_PARAMETERS and EVENT_FILTER_DESCRIPTOR structures to filter on specific conditions in a logger session.

When stack walking is enabled for a provider, then the stack is captured for all the events generated by the provider. Most of the time, the user is only interested in stack from only certain number of events.

This feature allows enabling or disabling stack walking on a list of events. The provided filter includes a EVENT_FILTER_EVENT_ID structure that contains an array of event IDs and a Boolean value that indicates whether to enable or disable stack capturing for the specified events. Each event write call will go through this array quickly to find out whether the stack should be captured or not.

With Windows Performance Recorder it is possible to achieve this in the WPR Profile with a second EventCollectorId entry which has an EventProviders entry where stackwalking is enabled.

In this demo profile, I created one EventProvider (EventProvider_DotNETRuntime) for provider Microsoft-Windows-DotNETRuntime without stacks to capture JIT and GC data and an other EventProvider (EventProvider_DotNETRuntime_Stack) for provider Microsoft-Windows-DotNETRuntime with stacks to capture stacks for Exceptions and Loader Events.

<?xml version="1.0" encoding="utf-8"?>
<WindowsPerformanceRecorder Version="1.0" Author="MagicAndre1981" Copyright="MagicAndre1981">
    <SystemCollector Id="SystemCollector" Name="NT Kernel Logger">
      <BufferSize Value="1024" />
      <Buffers Value="384" />
    <EventCollector Id="EventCollector_DotNETRuntime_Session" Name="DotNETRuntime_Session">
      <BufferSize Value="1024" />
      <Buffers Value="128" />
    <EventCollector Id="EventCollector_DotNETRuntime_with_Stack" Name="DotNETRuntime_Session_with_Stack">
      <BufferSize Value="1024" />
      <Buffers Value="128" />
    <SystemProvider Id="SystemProvider">
        <Keyword Value="ProcessThread" />       <!--PROC_THREAD-->
        <Keyword Value="Loader" />              <!--LOADER-->
        <Keyword Value="SampledProfile" />      <!--PROFILE-->
        <Keyword Value="Interrupt"/>            <!--INTERRUPT-->
        <Keyword Value="DPC"/>                  <!--DPC-->
        <Keyword Value="ReadyThread" />         <!--Dispatcher-->
        <Keyword Value="CSwitch" />             <!--CSwitch-->
        <Stack Value="SampledProfile" />        <!--Profile-->
        <Stack Value="CSwitch" />               <!--CSwitch-->
        <Stack Value="ReadyThread" />           <!--ReadyThread-->
        <Stack Value="ImageLoad" />             <!--ImageLoad-->
        <Stack Value="ImageUnload" />           <!--ImageUnload-->
    <EventProvider Id="EventProvider_DotNETRuntime" Name="Microsoft-Windows-DotNETRuntime" Level="5" Stack="false">
        <Keyword Value="0x111" />                       <!--GCKeyword, JitKeyword, JitRundownKeyword, EndRundownKeyword -->
    <EventProvider Id="EventProvider_DotNETRuntime_Stack" Name="Microsoft-Windows-DotNETRuntime" Level="5" Stack="true">
        <Keyword Value="0x8008" />                      <!--LoaderKeyword, LoaderRundownKeyword, ExceptionKeyword -->
    <EventProvider Id="EventProvider_DotNETRuntimePrivate" Name="763fd754-7086-4dfe-95eb-c01a46faf4ca" Level="5" Stack="false">
        <Keyword Value="0xE" />
    <EventProvider Id="EventProvider_DotNETRuntimeRundown_CaptureState" Name="Microsoft-Windows-DotNETRuntimeRundown" Level="5" CaptureStateOnly="true" Stack="false">
        <Keyword Value="0x118" />
    <Profile Id="DotNetRuntimeProfile.Verbose.File" Name="DotNetRuntimeProfile" Description="DotNetRuntime Profile" LoggingMode="File" DetailLevel="Verbose">
        <SystemCollectorId Value="SystemCollector">
          <SystemProviderId Value="SystemProvider" />
        <EventCollectorId Value="EventCollector_DotNETRuntime_Session">
            <EventProviderId Value="EventProvider_DotNETRuntime" />
            <EventProviderId Value="EventProvider_DotNETRuntimePrivate" />
            <EventProviderId Value="EventProvider_DotNETRuntimeRundown_CaptureState" />
        <EventCollectorId Value="EventCollector_DotNETRuntime_with_Stack">
            <EventProviderId Value="EventProvider_DotNETRuntime_Stack" />
    <Profile Id="DotNetRuntimeProfile.Verbose.Memory" Name="DotNetRuntimeProfile" Description="DotNetRuntime Profile" Base="DotNetRuntimeProfile.Verbose.File" LoggingMode="Memory" DetailLevel="Verbose"/>
    <TraceMergeProperty Id="BaseVerboseTraceMergeProperties" Name="BaseTraceMergeProperties" Base="">
          <CustomEvent Value="ImageId"/>
          <CustomEvent Value="BuildInfo"/>
          <CustomEvent Value="VolumeMapping"/>
          <CustomEvent Value="EventMetadata"/>
          <CustomEvent Value="PerfTrackMetadata"/>
          <CustomEvent Value="NetworkInterface"/>
      <FileCompression Value="true" />

When you now run Windows Performance Recorder to capture the data:

"C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\wpr.exe" -start  DotNetRuntime.wprp

, stop the recording

"C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\wpr.exe" -stop Result.etl

open the trace with Windows Performance Analyzer, load the debug symbols you can see the stacks for the Exception data, but not for Jit or GC events:


Attention. When you run this under Windows 7 or Windows 8 (Build 9200), the last EventLogger for the provider is used with the specified keywords and stack options. Here you should create 2 WPRP profiles and detect the Windows version and run the correct profile.


Styling Windows Phone 8.1/WinRT AppBarButton

I'm currently looking to implement a CommandBar for a WinRT Windows Phone 8.1 app. Overall it is very straightforward but I am unable to style the control. I have themed my app so that the accent colour has been changed to green. This works well for pretty much everywhere in...

VBS - how to run two browser one is full screen and another is minimised?

I have a kiosk where i need to run Chrome.exe as --kiosk and another Chrome.exe minimised. Using regedit run method VBS is executed. Problem is on reboot it is messed up always the minimised chrome.exe does not start as minimised, always its shows on top of --kiosk mode. How can...

Switch back to PowerShell mode after switching to cmd mode

From PowerShell, we can run cmd to switch to a command prompt. From there, how can we switch back to PowerShell. For instance... PS> cmd C:\temp> echo I am in command mode. I am in command mode. C:\temp> echo How do I switch back to PowerShell mode? How do I...

How to call a function in Windows 8 app?

I created a function like this: text: function () { document.getElementById("id").innerText = "Hello"; } I tried to call this function from another function like this and it doesn't work: anotherFunction: function () { this.text(); } The error I get: Unhandled exception at line 89, column 21 in ms-appx://b9f1ea0e-9eeb-41e4-a788-92c282715e21/pages/game/game.js 0x800a01b6 -...

Monogame running very slow on Windows Phone

Recently, I decided to resurrect one of my old XNA game projects and port it to a Windows Universal App using Monogame. I managed to get the game running perfectly (albeit with a little less performance) on Windows 8.1, but ran into some huge problems with Windows Phone. First, it...

DataBinding Collection and change element of collection

I have a colection and a ListView to which I have binded a collection of objects: <ListView ItemsSource="{Binding Levels}"... /> Here is a Levels collection: private ObservableCollection<Level> _levels; public ObservableCollection<Level> Levels { get { return _levels; } set { SetProperty(ref _levels, value); } } And here is a Level class:...

How can I bind Pushpin location in WPF using MVVM?

I'm developing a Desktop application that uses Bing maps and MVVM. In the application, a user adds a Pushpin in the map by double clicking on it, the Pushpin location gets saved in an Event class and the Event class is sent through a WCF Service. I would like to...

Java - how to get the stack trace from before a Runnable?

I had a close look at the SO "questions that may already have your answer" here and surprised not to find what I'm asking for... When an exception occurs in (for example) the EDT, or you just want to examine the stack for whatever reason, it's trivial to find the...

TFS build error: Could not find SDK “Bing.Maps.Xaml, Version=1.313.0825.0”

I want to build my windows 8 application on tfs but I have a problem with Bing maps sdk. There are no Bing maps dll that I can easily add it to references. How can I solve the problem? I got this error in tfs build log file. "C:\Builds\1\...sln" (default...

WinJS app with C# background task for push notifications

I'm trying to create a background task for push notifications in C# that is linked to a winjs app (before anyone asking: reason not to do this in js is because a bug in windows phone runtime, see here). Here is my first draft: public sealed class myPushNotificationBgTask : IBackgroundTask...

Redirect content to a file in ascii encoding

We're running lessc from the PowerShell like this: lessc -x style.less > style.min.css Unfortunately, style.min.css file is in unicode whereas we would like it to be in ascii. How can we force that encoding when writing the result to a file from PowerShell? Interestingly, when we run the same command...

Run Windows 10 Universal Apps on Windows 8.1

Is it possible to run a windows 10 universal app on windows 8.1? I searched a lot, but I didn't find a clear answer on MSDN etc. Thanks....

Play lock screen slideshow in Windows 8 from RSS (RequestSetImageFeedAsync error)

I'm trying to use method public static IAsyncOperation<SetImageFeedResult> RequestSetImageFeedAsync(Uri syndicationFeedUri) to play lock screen slideshow from external Uri in Windows 8. When I set this RSS Uri from this tutorial, and open "Change PC Settings", I always see message: "You need more than one picture to show in...

How to get a button's ID when clicked in Windows 8 apps?

I'm trying to get the ID of the button I clicked but I can't do it. I tried everything but it doesn't work. How can I do this? ...

How do you calculate pixel size of string?

I have a string. I know the font family and the font size it is going to be displayed in. I need to know how many pixels the text will take up in the ui. So that I can determine whether to show another element. How would I do that?...

Passing a reference to template function call operator overload

I have a class which overloads the function call operator with a template function, like so: class Test { public: template<class T> void operator()(T t) { std::cout<<(&t)<<std::endl; }; }; I'd like to call it with a reference argument, however when trying to do so, it passes the argument as a...

Unable to resolve property '%1' while processing properties for Uid '%0'

I'm trying to localize my WP 8.1 app. Here is a part of Strings/en-us/Resources.resw: <data name="SampleProperty.Text" xml:space="preserve"> <value>Sample text</value> </data> <data name="SampleProperty.SomeRandomKey" xml:space="preserve"> <value>SAMPLE TEXT</value> </data> Also one of application pages contains the following code: <TextBlock x:Uid="SampleProperty" /> But the app throws an exception in process of navigation to that...

ResolutionScale vs RawPixelsPerViewPixel on Windows Phone 8.1

I'm currently working on a universal Windows 8.1 / Windows Phone 8.1 application, and am trying to make sense of the various types of display information that's being presented to me. For Windows Phone, we have access to two different properties in the DisplayInformationClass: ResolutionScale RawPixelsPerViewPixels ResolutionScale seems to only...

How to run a script on startup in hidden mode

I have a batch file, named prova.bat, and I need to launch it at the startup of the computer, and I need to launch it in hidden mode (with no visible prompt). I have found on the net solutions to launch the batch at the startup OR solutions to launch...

Casting string as int causes the value to change

I am trying to read in a text file and change the value of a number on a certain line in Powershell in Windows 8.1. The file is somewhat predictable. I am not currently finding this the best way, but I am trying to track down why this bug occurs....

the dispatchertimer is by default running for the whole app and does not stop

The dispatchertimer by default in running for the entire application windows 8.1 I want that it should start only when a particular item is clicked but it's running for entire app..

Get actual class from stack trace element

Using Eclipse I can set a breakpoint and see current stack trace on debug view: But when I inspect stack trace using Thread.currentThread().getStackTrace(), the information I get is not exactly the same. For example, selected element is JUnitTestClassReference and the correlated one in stack trace (within dashes) is JUnit4TestReference (its...

Background color part of textbox

I've been trying to set a background color to a part of a textblock. Since there is no function to this with in the TextBlock itself I figured I should be adding inlines. However the inline objects (Run, Span, e.g) have a private background field that gets its value from...

Fill Windows Share Charm with Clipboard Data

I want to share data in the Clipboard (for example Images) through the share charm. Is it possible to use the windows clipboard content in the Windows 8.1 Share Charm? Unfortunately the DataTransferManager isn't available in desktop apps, so how am I able to share the clipboard with the charms-bar?

Preserve Java stack trace across threads

I am using ExecutorService to send mails asynchronously, so there is a class: class Mailer implements Runnable { ... That handles the sending. Any exception that gets caught is logged, for (anonymized) example: javax.mail.internet.AddressException: foo is bar at javax.mail.internet.InternetAddress.checkAddress( ~[mail.jar:1.4.5] at javax.mail.internet.InternetAddress.parse( ~[mail.jar:1.4.5] at javax.mail.internet.InternetAddress.parse( ~[mail.jar:1.4.5] at...

Why does main function differ from other function from stack point of view

I'm studying to use gdb and i got little confused. Here is my code: #include <stdio.h> #include <stdlib.h> #include <string.h> void g(char *password) { } int main(int argc, char *argv[]) { if(argc > 1) { g(argv[1]); } } So with the regular function (g() in this example) if I want...

how to set focus to a SearchBox control in windows 8.1 store app?

I am developing a windows 8.1 store app. I have a SearchBox control in my app. I want to set focus on it when pointer is pressed on it. I have tried the following code but it is not working private void SearchBox_FullView_PointerPressed(object sender, PointerRoutedEventArgs e) { SearchBox_FullView.Focus(FocusState.Pointer); } How...

navigating between pages using radio buttons in winrt

i'm trying to navigate between pages while toggling the radio buttons like the tab control. i've tries a few ways.Here they are first the xaml <StackPanel> <RadioButton Content="navigateto1" Checked="RadioButton_Checked"/> <RadioButton Content="navigateto2" Checked="RadioButton_Checked_1"/> <Frame x:Name="contentframe"> </Frame> </StackPanel> then the code behind private void RadioButton_Checked( object sender, RoutedEventArgs e ) { var...

How to get current country location and possibly the CountryCode from a Windows Phone 8.1

How to get current country location and possibly the CountryCode from a Windows Phone 8.1? I did this, but FindLocationsAsync throws me an exception "Value does not fall within the expected range" private async void LocateMe() { Geolocator GeoLoc = new Geolocator(); GeoLoc.DesiredAccuracyInMeters = 50; try { Geoposition GeoPosition =...

Windows 10 FIle query issues

I am trying to follow the instructions to get files from the knownfolders in windows 10 as shown below, try { StorageFolder folder = KnownFolders.PicturesLibrary; IReadOnlyList<StorageFile> pics = await folder.GetFilesAsync(Windows.Storage.Search.CommonFileQuery.OrderByDate, 0, 20); Debug.WriteLine(pics.Count); } catch(Exception ex) { Debug.WriteLine(ex.Message); } The same code works in WindowsPhone 8.1 SDK. But on...

C# numeric onscreen keyboard

I'm developing app for tablet with Win 8.1. I've got some TextBoxes with numeric input only and I need to popup numeric onscreen keyboard instead of standard one when entered. There's InputScope for WinPhone. Exists anything similar for Win 8.1?

Collapsed Grid in StackPanel change position of other controls in StackPanel

I have this Xaml Page: <StackPanel Orientation="Horizontal"> <Grid x:Name="inkGrid0" Margin="0,0,0,0" HorizontalAlignment="Left" > <Canvas x:Name="inkCanvas0" Width="570"> <Canvas.Background> <ImageBrush x:Name="DImage0" ImageSource="{Binding}"/> </Canvas.Background> </Canvas> </Grid> <Grid x:Name="inkGrid1" Margin="0,0,0,0" HorizontalAlignment="Right" > <Canvas x:Name="inkCanvas1" Width="570"> <Canvas.Background> <ImageBrush x:Name="DImage1"...

InnoSetup - while compiling sign tool failed with exit code 0x1

Its failing to compile in signing. In my innosetup packaging i have to include some third party software such as VLC, Google Chrome, Putty, etc etc. The moment those third party tools are included compile/build is failing. But when i do not use them its compiling well. (unfortunately i cant...

Bash alias doesn't work in cygwin

Can someone please explain to me how to set up bash aliases? I am using cygwin on windows 8. I added alias my_first_alias='git status' at the end of /.bashrc file. Typing my_first_alias into cygwin results in -bash: my_first_alias: command not found. Trying to restart cygwin, running . .bashrc doesn't help...

UnicodeDecodeError in pip install flake8 on Windows 8.1

I'm trying to install the flake8 module for Python (in order to use the SublimeLinter-flake8 package to Sublime Text 3) but get an error message on install (below). What am I doing wrong here? C:\Windows\system32>python -m pip install flake8 Collecting flake8 Exception: Traceback (most recent call last): File "C:\Python27\lib\site-packages\pip\", line...

Cannot install Visual Studio Professional and Community on Windows 8.1 Enterprise

I have a problem installing VS Professional 2012 and VS Community 2013 on Windows 8.1. The installation app crashes right after I open it. Following installation tips I disabled anti-virus and firewall software and I installed all the available Windows updates, but nothing has changed. Furthermore, I disabled .NET 3.5...

Checking for updates to Windows Store apps from within the application

I'm trying check (programatically) for updates to Windows Store apps from within the application and notifying users about the new release. How can i get the version of the app avalaible on Windows Store ? Thanks...

Windows 8: Must enter login password twice

I've seen many posts about this error but in my case the password is being typed correctly but is always rejected on the first attempt, saying Your PC is offline. Please sign in with the last password. I know Windows tries to authenticate Live accounts with their servers, but it's...

How do I get python to fetch information from command prompt such as 'tasklist'

I want a program in python that can get a list of all of the programs running, like all the .exe's, and I want to be able to get them into a variable or array so that I can maybe use a for loop to go through them and filter...

MS Access running a funtion from scheduled task not working

I am trying to run a macro daily from the windows task scheduler (w8.1 for tesing and server 2012 in production - both have the same problem) my .bat file: C:\Batch\attrib.exe -r C:\...\db.mdb rem ping -n 1 -w 10000 > nul "C:\Program Files (x86)\Microsoft Office 2003\OFFICE11\MSACCESS.EXE" "C:\...\db.mdb" /x "Launch"...

How do I find the line of my code causing an error when the stacktrace only shows native methods in eclipse

The short question is when using eclipse, how can I find out what line of my code triggered the error in cases where the stacktrace and debugger call stack don't reveal anything other than Android native methods. I have been trying for a while to debug a program and have...

How can i import in my WPF project?

I am really confused about windows media capture namespace, I would like to import the namespace to develop camera function in windows 8.1. FYI, I developed using visual studio 2013 and windows 7 64 bit, i already tried to install windows 8 Software Development Kits also, but i still can't...

Jasmine2 Stacktrace

When we run our Protractor tests with the jasmine2 framework we get rather useless stack traces such as the following. These are sporadic and never in the same place twice. I can re-run the tests and it'll work just fine. What exact causes this type of error and how can...

Google Chrome - How to compile Google Chrome in Windows?

Documentation mentioned to compile i have to follow this instruction for Windows: So i did all the steps, but the following is failing how can i resolve it? C:\tpt\depot_tools>mkdir out\Debug C:\tpt\depot_tools>ninja -C out\Debug chrome ninja: error: loading '': Het systeem kan het opgegeven bestand niet vinden. ninja: Entering directory...

How to split text with HTML tags to array

I have very simple text with HTML (only <b> tag) e.g. Lorem Ipsum is <b>simply dummy</b> text of the printing and <b>typesetting industry</b> I would like to split the text to array like this: [0] - Lorem Ipsum is [1] - <b>simply dummy</b> [2] - text of the printing and...

How to get current currency code of current location in Windows Phone 8.1

I locate the current location - Country and Country Code, but how to get the currency code of this location in Windows Phone 8.1?

How to get a correctly-chained stack trace for exceptions thrown when handling other exceptions?

Suppose I am handling FooException and BarException occurs. Let's assume they are both unchecked exceptions. What I want to see in the stacktrace is: Bar Message at com.baz.BazCode( ... Caused by: Foo Message at com.baz.BazCode( .... Caused by: ... However, by default, all record of FooException will be...

How to print the first line from a traceback stack

Suppose I am given the following traceback: Traceback (most recent call last): File "<wingdb_compile>", line 3, in <module> File "C:\Python34\lib\", line 419, in login resp = self.sendcmd('PASS ' + passwd) File "C:\Python34\lib\", line 272, in sendcmd return self.getresp() File "C:\Python34\lib\", line 245, in getresp raise error_perm(resp) ftplib.error_perm: 530 Login incorrect....

Activate Stacks only for some specific ETW Tasks in a provider?

Since Windows 7 it is possible to activate callstacks for usermode events. This works fine, but sometimes activating stacks for all tasks/Events in a provider is not needed and it would be nice to only activate stacks for some specific Tasks. Is this possible?