locked
System.ArgumentException - Use of undefined keyword value 1 for event TaskScheduled in async RRS feed

  • Question

  • Getting System.ArgumentException - Use of undefined keyword value 1 for event TaskScheduled in async apis.

    I am using WP8.1 Universal app.  The exceptions happens in Emulator mode.  I have spent a day researching this issue without any resolution.  

    Please do not punt to article System.ArgumentException in mscorlib.ni.dll from Rob Caplan. There is no solution there either.

    The code is straight forward.   Once the internal exception is thrown, the await never returns.

    Is anyone else having these issues with async ?? resolution ?

    public async Task<StorageFolder> FolderExists(StorageFolder parent, string folderName)
    {
        StorageFolder result = null;
        try
        {
            // Exception happens here. The code never returns so the thread hangs
            result = await parent.GetFolderAsync(folderName);
        }
        catch (Exception ex)
        {
            if (FeishLogger.Logger.IsDebug)
                ex.LogException(() => string.Format("FolderExists File: {0}\\{1}", parent.Path, folderName));
        }
    
        return result;
    }

    Full exception below

    System.ArgumentException occurred
      _HResult=-2147024809
      _message=Use of undefined keyword value 1 for event TaskScheduled.
      HResult=-2147024809
      IsTransient=false
      Message=Use of undefined keyword value 1 for event TaskScheduled.
      Source=mscorlib
      StackTrace:
           at System.Diagnostics.Tracing.ManifestBuilder.GetKeywords(UInt64 keywords, String eventName)
      InnerException: 

    Saturday, July 12, 2014 3:24 PM

All replies

  • I continue to chase this issue for 2nd day.  There is something wrong when running the first await statement in an Universal app.

    I have a sample project available

    See the sample below. If you include a the Delay await, then all works.  If you remove it then it fails every time.

    private async Task AsyncMethod()
    {
        Debug.WriteLine("({0:0000} - Sync Debug)", Environment.CurrentManagedThreadId);
    
        // Uncomment this line to make it work
        //await Task.Delay(1);
    
        // Fails only if the line above is commented
        await Task.Run(() => Debug.WriteLine("({0:0000} - Async Debug)", Environment.CurrentManagedThreadId));
    }

    the line is called from here:

            protected override async void OnLaunched(LaunchActivatedEventArgs e)
            {
    #if DEBUG
                if (System.Diagnostics.Debugger.IsAttached)
                {
                    this.DebugSettings.EnableFrameRateCounter = true;
                }
    #endif
    
                Frame rootFrame = Window.Current.Content as Frame;
    
                // Do not repeat app initialization when the Window already has content,
                // just ensure that the window is active
                if (rootFrame == null)
                {
                    // Create a Frame to act as the navigation context and navigate to the first page
                    rootFrame = new Frame();
    
                    // TODO: change this value to a cache size that is appropriate for your application
                    rootFrame.CacheSize = 1;
    
                    if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                    {
                        // TODO: Load state from previously suspended application
                    }
    
                    // Place the frame in the current Window
                    Window.Current.Content = rootFrame;
                }
    
                if (rootFrame.Content == null)
                {
    #if WINDOWS_PHONE_APP
                    // Removes the turnstile navigation for startup.
                    if (rootFrame.ContentTransitions != null)
                    {
                        this.transitions = new TransitionCollection();
                        foreach (var c in rootFrame.ContentTransitions)
                        {
                            this.transitions.Add(c);
                        }
                    }
    
                    rootFrame.ContentTransitions = null;
                    rootFrame.Navigated += this.RootFrame_FirstNavigated;
    #endif
                    await AsyncMethod();
    
                    await AsyncMethods();
                    await AsyncMethods();
                    await AsyncMethods();
    
    
                    // When the navigation stack isn't restored navigate to the first page,
                    // configuring the new page by passing required information as a navigation
                    // parameter
                    if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
                    {
                        throw new Exception("Failed to create initial page");
                    }
                }
    
                // Ensure the current window is active
                Window.Current.Activate();
            }



    • Edited by ctarmor Sunday, July 13, 2014 6:11 PM
    Sunday, July 13, 2014 5:52 PM
  • I suspect this is an issue with Visual Studio 2013 Update 3.   My other silverlight 8 apps are suddenly  having the same issue,  not just the Universal app.   
    Monday, July 14, 2014 10:43 AM
  • Is any one form Microsoft looking at this board ?  

    I have removed, and reinstall, Windows Phone SDKs,  Emulators and Visual Studio.  After re installing everything the problem still persists !!  ..

    Microsoft please help

    Friday, July 18, 2014 10:12 AM
  • Please post a simple repro of this to OneDrive for someone to look at.

    Thanks!


    Jeff Sanders (MSFT)

    @jsandersrocks - Windows Store Developer Solutions @WSDevSol
    Getting Started With Windows Azure Mobile Services development? Click here
    Getting Started With Windows Phone or Store app development? Click here
    My Team Blog: Windows Store & Phone Developer Solutions
    My Blog: Http Client Protocol Issues (and other fun stuff I support)

    Monday, July 21, 2014 12:10 PM
  • Hi Jeff,

    Thanks for you reply. looks like it a problem with the initialization of the Tpl Event source. 

    Here is the project and some images.  

    Sample Project

    The Exception

    The Hack:

    Wednesday, July 23, 2014 12:40 AM
  • I'm having this issue when i'm trying to install a VCD file for Cortana on Windows Phone 8.1 apps, it's the third time that this happens:

     protected override async void OnNavigatedTo(NavigationEventArgs e)
            {
                    if (e.NavigationMode == NavigationMode.New)
                    {
                        var storageFile = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///VoiceCommands.xml"));
                        await Windows.Media.SpeechRecognition.VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(storageFile);
                    }
    }

    Thursday, July 24, 2014 11:09 PM
  • For got to attach this 3rd screen shot with the Hack #2. 

    Trap the Tpl Eventsource exception. It works 90% of the times.

    Friday, July 25, 2014 12:28 AM
  • Sounds like the same issue. Tpl EventSource fails the first time causing Async to hang or exception.  See the hack above and source code.  It is not 100% fix but it'll get you to run until Microsoft fixes it.
    Friday, July 25, 2014 12:29 AM
  • Thanks, I will look at this.

    Jeff Sanders (MSFT)

    @jsandersrocks - Windows Store Developer Solutions @WSDevSol
    Getting Started With Windows Azure Mobile Services development? Click here
    Getting Started With Windows Phone or Store app development? Click here
    My Team Blog: Windows Store & Phone Developer Solutions
    My Blog: Http Client Protocol Issues (and other fun stuff I support)

    Friday, July 25, 2014 1:16 PM
  • Hi C,

    Thanks for the project.  I set the project type to phone and ran it.  I don't get any exception when clicking the button.

    This is my version information:


    Jeff Sanders (MSFT)

    @jsandersrocks - Windows Store Developer Solutions @WSDevSol
    Getting Started With Windows Azure Mobile Services development? Click here
    Getting Started With Windows Phone or Store app development? Click here
    My Team Blog: Windows Store & Phone Developer Solutions
    My Blog: Http Client Protocol Issues (and other fun stuff I support)

    Friday, July 25, 2014 2:17 PM
  • Thanks for looking at it.  I am not sure  what info I can get you more details on,but here is some:

    Microsoft Visual Studio Professional 2013
    Version 12.0.30626.00 Update 3 RC
    Microsoft .NET Framework
    Version 4.5.51641

    Installed Version: Professional

    Team Explorer for Visual Studio 2013   06177-004-0444002-02032
    Microsoft Team Explorer for Visual Studio 2013

    Visual Basic 2013   06177-004-0444002-02032
    Microsoft Visual Basic 2013

    Visual C# 2013   06177-004-0444002-02032
    Microsoft Visual C# 2013

    Visual C++ 2013   06177-004-0444002-02032
    Microsoft Visual C++ 2013

    Visual F# 2013   06177-004-0444002-02032
    Microsoft Visual F# 2013

    Visual Studio 2013 Code Analysis Spell Checker   06177-004-0444002-02032
    Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

    Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

    The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

    Windows Phone SDK 8.0 - ENU   06177-004-0444002-02032
    Windows Phone SDK 8.0 - ENU

    Application Insights Tools for Visual Studio Package   1.0
    Application Insights Tools for Visual Studio

    ASP.NET Web Frameworks and Tools 2012.2   4.1.21001.0
    For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

    ASP.NET Web Frameworks and Tools 2013   5.2.20609.0
    For additional information, visit http://www.asp.net/

    Common Azure Tools   1.1
    Provides common services for use by Azure Mobile Services and Windows Azure Tools.

    JetBrains ReSharper 8.2.1   C# Edition build 8.2.1000.4556 on 2014-05-19T16:12:38
    JetBrains ReSharper 8.2.1 package for Microsoft Visual Studio. For more information about ReSharper, visit http://www.jetbrains.com/resharper/. Copyright © 2003–2014 JetBrains, Inc.

    Microsoft Advertising SDK for Windows Phone   
    Microsoft Advertising SDK for Windows Phone
    Build 

    Microsoft Team Foundation Server 2013 Power Tools   12.0
    Power Tools that extend the Team Foundation Server integration with Visual Studio.

    Microsoft Visual Studio Process Editor   1.0
    Process Editor for Microsoft Visual Studio Team Foundation Server

    Multilingual App Toolkit   3.0.1200.0
    Multilingual App Toolkit helps you localize your Windows Store app by providing file management, pseudo and machine translation, translation editor, and build integration. http://go.microsoft.com/fwlink?linkid=245767

    NuGet Package Manager   2.8.50313.46
    NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

    PreEmptive Analytics Visualizer   1.2
    Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

    SQL Server Data Tools   12.0.30919.1
    Microsoft SQL Server Data Tools

    Windows Azure Mobile Services Tools   1.1
    Windows Azure Mobile Services Tools

    Windows Azure Tools   2.3
    Windows Azure Tools for Microsoft Visual Studio 2013 - v2.3.20320.1602

    Windows Azure Tools   2.2
    Windows Azure Tools for Microsoft Visual Studio 2013 - v2.2.11003.1601

    Windows Phone 8.1 SDK Integration   1.0
    This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

    Workflow Manager Tools 1.0   1.0
    This package contains the necessary Visual Studio integration components for Workflow Manager.

    Saturday, July 26, 2014 1:08 AM
  • Here are all the files in:

    C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.1

    Saturday, July 26, 2014 1:29 AM
  • Jeff,

    I rebuilt my Surface Pro 2,  upgraded to Windows 8.1.

    Installed VS 2013 with Update 2, then upgraded to VS2013 with Update 3.

    Still seeing the same issue !.... I am not sure why you are not able to reproduce it.

    Perhaps you can do the same in a similar VM. Remember to set breakpoint on Argument Exception. 

    I am not sure what else to do here ... it is REALLY disappointing ...  If we need to, we can schedule a remote session to my dev station  for someone to take a look ...

    Carlos

    Wednesday, July 30, 2014 10:04 PM
  • Do not set a breakpoint on that.  It is a handled 1st chance exception.

    Jeff Sanders (MSFT)

    @jsandersrocks - Windows Store Developer Solutions @WSDevSol
    Getting Started With Windows Azure Mobile Services development? Click here
    Getting Started With Windows Phone or Store app development? Click here
    My Team Blog: Windows Store & Phone Developer Solutions
    My Blog: Http Client Protocol Issues (and other fun stuff I support)

    Wednesday, July 30, 2014 10:19 PM
  • Once the exception happen, the next await / async calls hangs.

    like this one. It never comes back.  A few times  the exception did no occur and the async calls do not hang.   

    varfile =awaitPodSys.LocalAppFolder.GetFileAsync(fullPath);

    Wednesday, July 30, 2014 10:37 PM
  • Can you upload your project zipped up again?  Maybe there is a difference in the projects.  I cannot repro this.  This is the async call that is hanging in your case and maybe I will see something if I can recreate the problem.

    You cannot reproduce this on a physical device either correct?  Does one emulator fail more than others?


    Jeff Sanders (MSFT)

    @jsandersrocks - Windows Store Developer Solutions @WSDevSol
    Getting Started With Windows Azure Mobile Services development? Click here
    Getting Started With Windows Phone or Store app development? Click here
    My Team Blog: Windows Store & Phone Developer Solutions
    My Blog: Http Client Protocol Issues (and other fun stuff I support)

    Thursday, July 31, 2014 12:45 PM
  • Just hit play and carry on. If this annoys you turn off "break at exceptions" in VS menu. Debug->Exceptions.

    CsA

    Saturday, August 9, 2014 8:30 PM
  • Was there ever a solution to this? I am still getting a hang after the exception (regardless if exception is being trapped or not).
    Thursday, September 18, 2014 8:28 PM
  • I'm getting the same issue on a WP8.1 project generated by Unity
    Tuesday, October 14, 2014 1:45 PM
  • Do you have a repro project.  If so, open a new forum thread and post all the details please.  I am going to lock this current thread because of lack of response on the original problem and 'me too' posts are not very useful to help solving issues!

    Thanks!

    Jeff


    Jeff Sanders (MSFT)

    @jsandersrocks - Windows Store Developer Solutions @WSDevSol
    Getting Started With Windows Azure Mobile Services development? Click here
    Getting Started With Windows Phone or Store app development? Click here
    My Team Blog: Windows Store & Phone Developer Solutions
    My Blog: Http Client Protocol Issues (and other fun stuff I support)

    Tuesday, October 14, 2014 1:50 PM