azure-webjobs-sdk
azure-webjobs-sdk copied to clipboard
Calling IBinder.BindAsync with a TableEntity / TableAttribute leads to NullReferenceException
I'm trying to call the following to get an entity. This fetches the table entity correctly as required however after completing the function call I get a NullReferenceException. This is the same regardless of using TableEntity or a class inheriting from ITableEntity.
TableEntity tableEntity = await binder.BindAsync<TableEntity>(new TableAttribute("TableName", partitionKey, rowKey));
Stack trace:
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=Microsoft.Azure.WebJobs.Extensions.Tables
StackTrace:
at Microsoft.Azure.WebJobs.Extensions.Tables.PocoEntityValueBinder`1.<SetValueAsync>d__9.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Microsoft.Azure.WebJobs.Binder.<Complete>d__14.MoveNext() in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Bindings\Runtime\Binder.cs:line 159
Repro steps
Provide the steps required to reproduce the problem
- Created a fresh Azure Function project targetting .net 6
- Added Microsoft.Azure.WebJobs.Extensions.Tables 1.0.0
- Added IBinder to the function signature along with the line above
Known workarounds
Calling BindAsync<TableClient>
then performing a query manually allows me to fetch the entity without an exception.