Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Studio 2015 & .NET 4.6
  4. ETW - ADO tracing does not work after EF

ETW - ADO tracing does not work after EF

Scheduled Pinned Locked Moved Visual Studio 2015 & .NET 4.6
csharpdatabasevisual-studiosecuritydebugging
1 Posts 1 Posters 11 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gaston Verelst
    wrote on last edited by
    #1

    After I got ETW working I fell into this unexpected behavior: When I run a program where I first do some plain ADO.NET calls, and then EF calls, both are logged. BUT when I first do the EF calls, the ADO.NET calls that come afterwards aren't logged anymore. In the test program below executing readADO() before ReadEF() will give me all the 4 select statements in the log file (including "select name from sales.store"), switching the 2 functions will not display the ADO.NET SQL statement anymore. Tracing setup: ctrl.guid.adonet

    {7ACDCAC8-8947-F88A-E51A-24018F5129EF} 0xFFFFFFFF 5 ADONETDIAG.ETW
    {914ABDE2-171E-C600-3348-C514171DE148} 0xFFFFFFFF 5 System.Data.1
    {A68D8BB7-4F92-9A7A-D50B-CEC0F44C4808} 0xFFFFFFFF 5 System.Data.Entity.1
    {C9996FA5-C06F-F20C-8A20-69B3BA392315} 0xFFFFFFFF 5 System.Data.SNI.1
    {BA798F36-2325-EC5B-ECF8-76958A2AF9B5} 0xFFFFFFFF 5 SQLNCLI.1

    test.bat

    logman start adonettrace -pf .\ctrl.guid.adonet -o adonettrace.etl -ets
    "C:\Users\DBEGAVE\Documents\visual studio 2012\Projects\TestETW\TestETW\bin\Debug\testETW.exe"
    logman stop adonettrace -ets
    tracerpt -of csv .\adonettrace.etl -y
    perfview -BufferSize:2048 .\adonettrace.etl

    Any thoughts? Thanks, Gaston

    static void Main(string[] args)
    {
    ReadADO();
    ReadEF();
    }

    private static void ReadADO()
    {
    using (SqlConnection conn = new SqlConnection(@"Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=AdventureWorks2008R2;Data Source=.\sqlexpress"))
    {
    conn.Open();
    using (SqlCommand cmd = conn.CreateCommand())
    {
    cmd.CommandText = "select name from sales.store";
    using (SqlDataReader rdr = cmd.ExecuteReader())
    {
    while (rdr.Read())
    {
    Console.WriteLine(rdr.GetString(0));
    }
    }
    }
    }
    }

    private static void ReadEF()
    {
    using (AdventureWorksEntities db = new AdventureWorksEntities())
    {
    foreach (Store s in db.Stores)
    {
    Console.WriteLine(s.Name);
    }
    }
    }

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups