Azure / Azure/azure-functions-host
System.ArgumentNullException when referencing a non-existent Blob
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 36
Description
function.json:
``` json
{
"scriptFile": "main.py",
"disabled": false,
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req"
},
{
"type": "blob",
"direction": "in",
"name": "file",
"connection": "AzureWebJobsStorage",
"path": "python-worker-tests/test-nonexistent.txt"
},
{
"type": "http",
"direction": "out",
"name": "$return",
}
]
}
```
Host output:
```
info: Function.get_blob_nonexistent[0]
=> System.Collections.Generic.Dictionary`2[System.String,System.Object] => System.Collections.Generic.Dictionary`2[System.String,System.Object]
Executing 'Functions.get_blob_nonexistent' (Reason='This function was programmatically called via the host APIs.', Id=86e46cb8-138c-41fb-a0ff-5f93c152b5c9)
fail: Host.Results[0]
=> System.Collections.Generic.Dictionary`2[System.String,System.Object] => System.Collections.Generic.Dictionary`2[System.String,System.Object]
Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: Functions.get_blob_nonexistent ---> System.ArgumentNullException: Value cannot be null.
Parameter name: stream
at System.IO.StreamReader..ctor(Stream stream, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean leaveOpen)
at System.IO.StreamReader..ctor(Stream stream)
at Microsoft.Azure.WebJobs.Script.Binding.FunctionBinding.ConvertStreamToValue(Stream stream, DataType dataType, Object& converted) in C:\azure-webjobs-sdk-script\src\WebJobs.Script\Binding\FunctionBinding.cs:line 313
at Microsoft.Azure.WebJobs.Script.Binding.FunctionBinding.d__19.MoveNext() in C:\azure-webjobs-sdk-script\src\WebJobs.Script\Binding\FunctionBinding.cs:line 245
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.WebJobs.Script.Binding.ExtensionBinding.d__7.MoveNext() in C:\azure-webjobs-sdk-script\src\WebJobs.Script\Binding\ExtensionBinding.cs:line 63
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.WebJobs.Script.Description.WorkerLanguageInvoker.<>c__DisplayClass7_0.<b__1>d.MoveNext() in C:\azure-webjobs-sdk-script\src\WebJobs.Script\Description\Rpc\WorkerLanguageInvoker.cs:line 92
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Microsoft.Azure.WebJobs.Script.Description.WorkerLanguageInvoker.d__7.MoveNext() in C:\azure-webjobs-sdk-script\src\WebJobs.Script\Description\Rpc\WorkerLanguageInvoker.cs:line 96
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Microsoft.Azure.WebJobs.Script.Description.WorkerLanguageInvoker.d__6.MoveNext() in C:\azure-webjobs-sdk-script\src\WebJobs.Script\Description\Rpc\WorkerLanguageInvoker.cs:line 55
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Microsoft.Azure.WebJobs.Script.Description.FunctionInvokerBase.d__24.MoveNext() in C:\azure-webjobs-sdk-script\src\WebJobs.Script\Description\FunctionInvokerBase.cs:line 84
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Microsoft.Azure.WebJobs.Script.Description.FunctionGenerator.d__3`1.MoveNext() in C:\azure-webjobs-sdk-script\src\WebJobs.Script\Description\FunctionGenerator.cs:line 225
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`2.d__9.MoveNext() in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionInvoker.cs:line 63
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__24.MoveNext() in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 533
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__23.MoveNext() in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 484
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__22.MoveNext() in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 427
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__16.MoveNext() in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 232
--- End of inner exception stack trace ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__16.MoveNext() in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 276
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__13.MoveNext() in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 76
fail: Function.get_blob_nonexistent[0]
=> System.Collections.Generic.Dictionary`2[System.String,System.Object] => System.Collections.Generic.Dictionary`2[System.String,System.Object]
System.Private.CoreLib: Exception while executing function: Functions.get_blob_nonexistent. System.Runtime.Extensions: Value cannot be null.
Parameter name: stream.
fail: Function.get_blob_nonexistent[0]
=> System.Collections.Generic.Dictionary`2[System.String,System.Object] => System.Collections.Generic.Dictionary`2[System.String,System.Object]
Executed 'Functions.get_blob_nonexistent' (Failed, Id=86e46cb8-138c-41fb-a0ff-5f93c152b5c9)
```
Contributor guide
Assessment
This issue has not been assessed yet.