Azure / Azure/azure-functions-host
Runtime error in azure function for System.Runtime.CompilerServices.Unsafe
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Description
Hi,
I am using Microsoft.Azure.Devices.Client": "1.18.1" in my Azure Function on V1. First I got error for assembly "DotNetty.Common": "0.6.0.0". I tried to add this assembly reference explicitly in my project.json and the error got resolved. Now I am getting error for assembly "System.Runtime.CompilerServices.Unsafe": "4.0.4.1". I have tried to explicitly add its reference too in my project.json, however it still throws same error on method call UpdateReportedPropertiesAsync().
My project.json;
{
"frameworks": {
"net46":{
"dependencies": {
"Microsoft.Azure.Devices.Client": "1.18.1",
"Microsoft.Azure.Devices.Shared": "1.15.1",
"DotNetty.Common": "0.6.0.0",
"System.Runtime.CompilerServices.Unsafe": "4.0.4.1"
}
}
}
}
Error log;
2018-12-17T15:43:09.035 [Warning] Unable to find assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Are you missing a private assembly file?
2018-12-17T15:43:09.051 [Warning] Unable to find assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Are you missing a private assembly file?
2018-12-17T15:43:09.254 [Error] Exception while executing function: Functions.EventHubTriggerToIoTHubUpdateDeviceTwin. mscorlib: Exception has been thrown by the target of an invocation. mscorlib: One or more errors occurred. Microsoft.Azure.Devices.Client: I/O error occurred.
- Function App version: 1.0
- Function Log; 2018-12-17T15:43:09.441 [Error] Function completed (Failure, Id=f6330e75-064c-468f-8909-3db795a27a56, Duration=1885ms)
#### Expected behavior
Function should run with default assemblies loaded, or it should load assembly defined in project.json
#### Actual behavior
Function complies, but it throws run time errors
```csharp code sample
Client = DeviceClient.CreateFromConnectionString(DeviceConnectionString, TransportType.Mqtt); TwinCollection reportedProperties = PrepareReportedProperties(myDevice);
Task taskUpdate = Client.UpdateReportedPropertiesAsync(reportedProperties);
Contributor guide
Research direction
Start with Azure Functions V1 assembly-loading behavior around project.json and the UpdateReportedPropertiesAsync call, using the supplied dependency versions to reproduce the System.Runtime.CompilerServices.Unsafe 4.0.4.1 failure. Done means the function runs without the missing-assembly error, or the repository clearly documents the supported resolution or limitation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100