none
Error indexing method, could not load type RRS feed

  • Question

  • I've recently started getting an error when trying to run an azurewebjob in the debugger.

    This had been working up until this last Friday, now some, but not all, of my webjobs throw a error indexing method error.

    I'm quite new to azure web jobs, so it's likely I messed something up, but even reverting back to an older repo doesn't resolve the issue. Friday, when the problems started happening, it downloaded something (new CLI I think?) when I went to run it in the debugger.

    My console spews out the following:

    your worker runtime is not set. As of 2.0.1-beta.26 a worker runtime setting is required.
    Please run `func settings add FUNCTIONS_WORKER_RUNTIME <option>` or add FUNCTIONS_WORKER_RUNTIME to your local.settings.json
    Available options: dotnet, node, java

                      %%%%%%
                     %%%%%%
                @   %%%%%%    @
              @@   %%%%%%      @@
           @@@    %%%%%%%%%%%    @@@
         @@      %%%%%%%%%%        @@
           @@         %%%%       @@
             @@      %%%       @@
               @@    %%      @@
                    %%
                    %

    Azure Functions Core Tools (2.0.1-beta.36)
    Function Runtime Version: 2.0.12050.0
    info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
          User profile is available. Using 'C:\Users\bryce.bangerter\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
    info: Host.Startup[0]
          Reading host configuration file 'C:\Users\bryce.bangerter\source\repos\api-v2\TheBusiness.WebJobs\AzureFunctions\bin\Debug\netstandard2.0\host.json'
    info: Host.Startup[0]
          Host configuration file read:
          {
            "version": "2.0"
          }
    [9/4/2018 1:41:01 AM] Initializing Host.
    [9/4/2018 1:41:01 AM] Host initialization: ConsecutiveErrors=0, StartupCount=1
    [9/4/2018 1:41:02 AM] Starting JobHost
    [9/4/2018 1:41:02 AM] Starting Host (HostId=brycelap-959058231, InstanceId=38cfab58-cc21-4383-9b79-b644a6f42484, Version=2.0.12050.0, ProcessId=18596, AppDomainId=1, Debug=False, FunctionsExtensionVersion=)
    [9/4/2018 1:41:03 AM] Generating 3 job function(s)
    [9/4/2018 1:41:03 AM] Error indexing method 'BusinessData.DownloadFile'
    [9/4/2018 1:41:03 AM] Microsoft.Azure.WebJobs.Host: Error indexing method 'BusinessData.DownloadFile'. System.Private.CoreLib: Could not load type 'Microsoft.Azure.WebJobs.ExecutionContext' from assembly 'Microsoft.Azure.WebJobs.Extensions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null'.
    [9/4/2018 1:41:03 AM] Function 'BusinessData.DownloadFile' failed indexing and will be disabled.
    [9/4/2018 1:41:03 AM] Error indexing method 'BusinessData.Extract'
    [9/4/2018 1:41:03 AM] Microsoft.Azure.WebJobs.Host: Error indexing method 'BusinessData.Extract'. System.Private.CoreLib: Could not load type 'Microsoft.Azure.WebJobs.ExecutionContext' from assembly 'Microsoft.Azure.WebJobs.Extensions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null'.
    [9/4/2018 1:41:03 AM] Function 'BusinessData.Extract' failed indexing and will be disabled.
    [9/4/2018 1:41:03 AM] Error indexing method 'BusinessData.UploadFile'
    [9/4/2018 1:41:03 AM] Microsoft.Azure.WebJobs.Host: Error indexing method 'BusinessData.UploadFile'. System.Private.CoreLib: Could not load type 'Microsoft.Azure.WebJobs.ExecutionContext' from assembly 'Microsoft.Azure.WebJobs.Extensions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null'.
    [9/4/2018 1:41:03 AM] Function 'BusinessData.UploadFile' failed indexing and will be disabled.
    [9/4/2018 1:41:03 AM] Error indexing method 'BusinessReport.Extract'
    [9/4/2018 1:41:03 AM] Microsoft.Azure.WebJobs.Host: Error indexing method 'BusinessReport.Extract'. System.Private.CoreLib: Could not load type 'Microsoft.Azure.WebJobs.ExecutionContext' from assembly 'Microsoft.Azure.WebJobs.Extensions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null'.
    [9/4/2018 1:41:03 AM] Function 'BusinessReport.Extract' failed indexing and will be disabled.
    [9/4/2018 1:41:03 AM] Found the following functions:
    [9/4/2018 1:41:03 AM] AzureFunctions.Alerts.AlertTrigger.Run
    [9/4/2018 1:41:03 AM] AzureFunctions.Box.BoxTrigger.Run
    [9/4/2018 1:41:03 AM] AzureFunctions.Diffy.SettingsDiffyTrigger.Run
    [9/4/2018 1:41:03 AM]
    [9/4/2018 1:41:03 AM] Host initialized (1688ms)
    [9/4/2018 1:41:29 AM] The listener for function 'SettingsDiffyTrigger' was unable to start.
    [9/4/2018 1:41:29 AM] The listener for function 'SettingsDiffyTrigger' was unable to start. Microsoft.WindowsAzure.Storage: No such host is known. System.Net.Http: No such host is known. System.Private.CoreLib: No such host is known.
    [9/4/2018 1:41:29 AM] Host started (27692ms)
    [9/4/2018 1:41:29 AM] Job host started
    [9/4/2018 1:41:29 AM] The following 4 functions are in error:
    [9/4/2018 1:41:29 AM] BusinessDownloadFile: Could not load type 'Microsoft.Azure.WebJobs.ExecutionContext' from assembly 'Microsoft.Azure.WebJobs.Extensions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null'.
    [9/4/2018 1:41:29 AM] BusinessExtract: Could not load type 'Microsoft.Azure.WebJobs.ExecutionContext' from assembly 'Microsoft.Azure.WebJobs.Extensions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null'.
    [9/4/2018 1:41:29 AM] BusinessUploadFile: Could not load type 'Microsoft.Azure.WebJobs.ExecutionContext' from assembly 'Microsoft.Azure.WebJobs.Extensions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null'.
    [9/4/2018 1:41:29 AM] BusinessReportExtract: Could not load type 'Microsoft.Azure.WebJobs.ExecutionContext' from assembly 'Microsoft.Azure.WebJobs.Extensions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null'.
    [9/4/2018 1:41:29 AM]
    [9/4/2018 1:41:29 AM]
    Hosting environment: Production
    Content root path: C:\Users\bryce.bangerter\source\repos\api-v2\TheBusiness.WebJobs\AzureFunctions\bin\Debug\netstandard2.0
    Now listening on: http://0.0.0.0:7071
    Application started. Press Ctrl+C to shut down.
    Listening on http://0.0.0.0:7071/
    Hit CTRL-C to exit...

    Http Functions:

            AlertTrigger: http://localhost:7071/api/AlertTrigger

            BoxTrigger: http://localhost:7071/api/BoxTrigger

    [9/4/2018 1:41:31 AM] Retrying to start listener for function 'SettingsDiffyTrigger' (Attempt 1)
    [9/4/2018 1:41:59 AM] Executing 'SettingsDiffyTrigger' (Reason='Timer fired at 2018-09-03T19:41:59.8599949-06:00', Id=8973bbcf-61f7-44a5-8dcf-72c0cdd48352)
    [9/4/2018 1:42:00 AM] C# Timer trigger function executed at: 9/3/2018 7:41:59 PM
    C# Timer trigger function executed at: 9/3/2018 7:41:59 PM
    [9/4/2018 1:42:00 AM] Starting process...
    Starting process...
    [9/4/2018 1:42:00 AM] Fetching current settings from api: https://api2.thebusinessloc.com
    Fetching current settings from api: https://api2.thebusinessloc.com
    [9/4/2018 1:42:03 AM] Host lock lease acquired by instance ID '0000000000000000000000006CA9FB12'.
    [9/4/2018 1:42:24 AM] Response length: [ 8848 ]
    Response length: [ 8848 ]
    [9/4/2018 1:42:24 AM] Local Path: C:\Users\bryce.bangerter\AppData\Local\Temp\2cb8fd38-891b-48d0-b00b-dd2472d53834 Remote Project Path: https://business.visualstudio.com/TheBusiness/Systems%20Team/_git/stage-configuration File Name: settings-local.json
    Local Path: C:\Users\bryce.bangerter\AppData\Local\Temp\2cb8fd38-891b-48d0-b00b-dd2472d53834 Remote Project Path: https://business.visualstudio.com/TheBusiness/Systems%20Team/_git/stage-configuration File Name: settings-local.json
    [9/4/2018 1:42:26 AM] Exception encountered while processing dimensions framework settings diff and commit trigger.
    [9/4/2018 1:42:26 AM] LibGit2Sharp: request failed with status code: 404.
    Exception encountered while processing dimensions framework settings diff and commit trigger.
    LibGit2Sharp.LibGit2SharpException : request failed with status code: 404
       at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
       at LibGit2Sharp.Core.Proxy.git_clone(String url,String workdir,GitCloneOptions& opts)
       at LibGit2Sharp.Repository.Clone(String sourceUrl,String workdirPath,CloneOptions options)
       at AzureFunctions.Helpers.GitHelper.Clone(String localpath,String remotepath) at C:\Users\bryce.bangerter\source\repos\api-v2\TheBusiness.WebJobs\AzureFunctions\Helpers\GitHelper.cs : 42
       at AzureFunctions.Diffy.SettingsDiffyTrigger.GetOverridesViewAndCommitToGit() at C:\Users\bryce.bangerter\source\repos\api-v2\TheBusiness.WebJobs\AzureFunctions\Diffy\SettingsDiffyTrigger.cs : 63
       at AzureFunctions.Diffy.SettingsDiffyTrigger.Run(TimerInfo myTimer,TraceWriter log) at C:\Users\bryce.bangerter\source\repos\api-v2\TheBusiness.WebJobs\AzureFunctions\Diffy\SettingsDiffyTrigger.cs : 38
    [9/4/2018 1:42:27 AM] Executed 'SettingsDiffyTrigger' (Failed, Id=8973bbcf-61f7-44a5-8dcf-72c0cdd48352)
    [9/4/2018 1:42:27 AM] System.Private.CoreLib: Exception while executing function: SettingsDiffyTrigger. LibGit2Sharp: request failed with status code: 404.
    [9/4/2018 1:42:27 AM] The next 5 occurrences of the schedule will be:
    [9/4/2018 1:42:27 AM] 9/3/2018 8:05:59 PM
    [9/4/2018 1:42:27 AM] 9/3/2018 9:05:59 PM
    [9/4/2018 1:42:27 AM] 9/3/2018 10:05:59 PM
    [9/4/2018 1:42:27 AM] 9/3/2018 11:05:59 PM
    [9/4/2018 1:42:27 AM] 9/4/2018 12:05:59 AM
    [9/4/2018 1:42:27 AM]
    [9/4/2018 1:42:27 AM] Listener successfully started for function 'SettingsDiffyTrigger' after 1 retries.



    Note my AlertTrigger and BoxTrigger seem to load fine. My Business.... jobs throw the mentioned error. Not sure what to begin looking at to resolve this.

    Tuesday, September 4, 2018 1:58 AM

All replies

  • Hi,

    I am also facing same problem. Still don't know how to fix it. Thanks

    Error indexing method '...'
    Microsoft.Azure.WebJobs.Host: Error indexing method '..'. System.Private.CoreLib: Could not load type 'Microsoft.Azure.WebJobs.ExecutionContext' from assembly 'Microsoft.Azure.WebJobs.Extensions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null'.

    Tuesday, September 4, 2018 2:00 PM
  • Same here, just published to azure with the latest updates and now getting this error in our cloud environment;

    The function runtime is unable to start. System.Private.CoreLib: Could not load type 'Microsoft.Azure.WebJobs.ExecutionContext' from assembly 'Microsoft.Azure.WebJobs.Host, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null'.

    Tuesday, September 4, 2018 2:48 PM
  • Hey, I am also facing same problem and found solution for it. This issue is due to recent release of Microsoft function SDK update. Go to nuget package in project and update the Microsoft.NET.Sdk.Functions to latest i.e.v1,0.19 and rebuild project again and it will work. Thanks.
    • Proposed as answer by Dipendra K Tuesday, September 4, 2018 2:52 PM
    Tuesday, September 4, 2018 2:51 PM
  • Hi, I'm already using this version of the Sdk and it doesn't work in azure.  Everything works fine locally but its failing to run in Azure....  When you explore to the function within the Azure Portal, clicking on the function results in an error dialog (see below)

    

    When you click 'integrate' you can see the version of the Sdk as shown below.

    "generatedBy": "Microsoft.NET.Sdk.Functions-1.0.19",

    Tuesday, September 4, 2018 3:03 PM
  • In the latest release, the type ExtensionContext has moved from assembly Microsoft.Azure.WebJobs.Extensions to assembly Microsoft.Azure.WebJobs.Host. Since things are working locally for you on the latest version, it must be that your function app in Azure is pinned to an old version, causing the type load failure.

    To fix this, unpin your app in Azure so it is running with the latest version that you're using locally. I.e. change FUNCTIONS_EXTENSION_VERSION in your app settings from a pinned version to "beta".


    Mathew Charles [MSFT]



    Tuesday, September 4, 2018 5:56 PM
  • Hey, I am also facing same problem and found solution for it. This issue is due to recent release of Microsoft function SDK update. Go to nuget package in project and update the Microsoft.NET.Sdk.Functions to latest i.e.v1,0.19 and rebuild project again and it will work. Thanks.
    This fixed it for me. Thanks.
    Tuesday, September 4, 2018 8:03 PM
  • Side note: it's better to set it to ~2 then to beta. While it behaves the same today, ~2 sets you up on the right path for when v2 goes GA.

    David

    Wednesday, September 5, 2018 2:57 AM
  • In Application settings this is what I have

    When I go to Function app settings this is what I see

    This seems to suggest that the function app is configured as you suggest....  To clarify, the function was working and it only started showing this error after I upgraded the packages.  The message seems to be indicating that I need to delete the function completely and create a new one.  If this is so then this is really not great from a deployment point of view... Thoughts?

    Wednesday, September 5, 2018 8:28 AM
  • Hi, so after doing some investigation into this issue, it would appear that our functions seem to be pointing to different Runtime Versions leading to some functions working and some not.  Specifically;

    2.0.11961.0 (beta) works fine with version 1.0.14 of the Sdk but fails when using 1.0.19

    2.0.12050.0 (beta) seems to work fine with 1.0.19 of the Sdk

    What I don't understand is why my functions seem to targeting different versions of the runtime.  How do I force them all to use the later version?

    Cheers

    Mark


    Wednesday, September 5, 2018 9:16 AM
  • Just to update the thread, we are updating the FUNCTIONS_EXTENSION_VERSION to ~2 and that seems to be fixing the issue. Interestingly, when I downgrade the sdk locally from .19 to .14 I see the similiar issue that I see in Azure.
    Wednesday, September 5, 2018 10:57 AM
  • Thank you all, just to confirm how I solved:

    Started today with 500 error on my V2 function online with logs like:

    [Warning] Function 'MyApi.GetItem' failed indexing and will be disabled.

    [Error] Error indexing method 'MyApi.GetItem'

    Stopping and restarting, deleting wwwroot content and re-deploying didn't work.

    After reading this OP upgraded nuget SDK reference from 1.0.14 to 1.0.19.

    Then I found that project couldn't find storage "TableAttribute" anymore in beta8 since this function is a Table Storage CRUD wrapper, so I installed separate pre-release beta8 version of Microsoft.Azure.WebJobs.Extensions.Storage.

    SDK upgrade, Extensions Storage install and rebuild/redeploy did the trick.

    (I already had FUNCTIONS_EXTENSION_VERSION=~2)


    Marco

    Wednesday, September 5, 2018 4:20 PM
  • Yes, generally you'll want to be using ~2, and the latest nuget packages.

    David

    Wednesday, September 5, 2018 4:34 PM
  • Sure David, thank you for following this thread.

    But how exactly can we set up things in the best way to avoid downtime of published functions?


    Marco

    Wednesday, September 5, 2018 4:40 PM
  • Can you explain how you ended up with downtime? This announcement was posted ahead of the breaking release (and email was sent as well), so by pinning as suggested there, there should have been no down time to any published app.
    Wednesday, September 5, 2018 4:44 PM
  • Absolutely my fault, sorry, I actually missed the announcement and will better check about how to receive this kind of email alerts. Thank you again.


    Marco

    Wednesday, September 5, 2018 4:53 PM
  • @technetcolmar note that there should not be any more big breaking changes for v2, so normally, staying with ~2 is a safe bet now.
    Wednesday, September 5, 2018 4:58 PM