Search code examples
exceptionazure-webjobsazure-webjobssdk

FunctionIndexingException Can't bind Table to type on Azure WebJob Load


I think this is a case of out of date documentation but I'm unable to find a more recent example.

Using the following code generates an exception on the initialisation of the webjob and it gets stuck in a "pending restart" loop.

public static void GenerateExcelFile(
        [QueueTrigger("excel")] JobFile message,
        Guid Id,
        [Table("JobFile")] IDictionary<Tuple<string, string>, object> table,            
    {
        //More Code
    }

Replacing "object" with "JobFile" produces the same error. It's quite a length stacktrace so I've only posted the top of it here. Using ILSpy it looks like this shouldn't work so I'm not sure if this feature has been removed since the tutorial was written.

[09/13/2014 11:07:53 > be5c40: ERR ] Unhandled Exception:
        Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException:
            Error indexing method 'GenerateExcelFile' ---> 
            System.InvalidOperationException: Can't bind Table to type
           'System.Collections.Generic.IDictionary`2[System.Tuple`2[System.String,System.String],System.Object]'.
[09/13/2014 11:07:53 > be5c40: ERR ]    at Microsoft.Azure.WebJobs.Host.Tables.TableAttributeBindingProvider.TryCreateAsync(BindingProviderContext context)
[09/13/2014 11:07:53 > be5c40: ERR ]    at Microsoft.Azure.WebJobs.Host.Bindings.CompositeBindingProvider.<TryCreateAsync>d__0.MoveNext()

I've tried this on 0.5 beta and 0.6 beta of the SDK.


Solution

  • The documentation that you are pointing to is out of date. IDictionary binding was removed for Tables. You can use ICollector binding for Inserting or replacing, TableEntity/ IQueryable binding for reading and CloudTable binding for modifying an entity. The following samples demonstrate Tables usage https://github.com/Azure/azure-webjobs-sdk-samples/tree/master/BasicSamples/TableOperations https://github.com/bradygaster/siteMonitR