{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/azure-webjobs-sdk-script/issues/1514","repository_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk-script","labels_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk-script/issues/1514/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk-script/issues/1514/comments","events_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk-script/issues/1514/events","html_url":"https://github.com/Azure/azure-webjobs-sdk-script/issues/1514","id":229137252,"number":1514,"title":"Azure Functions: Exception while executing function: unable to find assembly 'System.Runtime, Version=4.1.0.0'","user":{"login":"khariq","id":4582312,"avatar_url":"https://avatars3.githubusercontent.com/u/4582312?v=3","gravatar_id":"","url":"https://api.github.com/users/khariq","html_url":"https://github.com/khariq","followers_url":"https://api.github.com/users/khariq/followers","following_url":"https://api.github.com/users/khariq/following{/other_user}","gists_url":"https://api.github.com/users/khariq/gists{/gist_id}","starred_url":"https://api.github.com/users/khariq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khariq/subscriptions","organizations_url":"https://api.github.com/users/khariq/orgs","repos_url":"https://api.github.com/users/khariq/repos","events_url":"https://api.github.com/users/khariq/events{/privacy}","received_events_url":"https://api.github.com/users/khariq/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-05-16T19:03:41Z","updated_at":"2017-05-16T20:34:00Z","closed_at":null,"body":"When attempting to use JsonConvert to deserialize a Service Bus message to a domain POCO, the following exception is through:\r\n\r\nUnable to find assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Are you missing a private assembly file?\r\n\r\n#### Repro steps\r\n```\r\n#r \"Newtonsoft.Json\"\r\n// Entities.dll is a netcoreapp1.1 assembly that defines our business POCOs\r\n#r \"Entities.dll\"\r\n\r\nusing System;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\nusing Newtonsoft.Json;\r\n\r\nusing Entities.Messages;\r\n \r\npublic static string Run(byte[] evaluationRequest, TraceWriter log)\r\n{\r\n\tvar body = System.Text.Encoding.UTF8.GetString(evaluationRequest);\r\n\r\n\tlog.Info($\"C# ServiceBus queue trigger function processed message: {body}\");\r\n\t    \r\n    try\r\n    {\r\n    \t// EvaluationRequest is defined in Entities.dll in the Entities.Messages namespace\r\n    \t// commenting this line out prints the log message\r\n        var message = JsonConvert.DeserializeObject<EvaluationRequest>(body);\r\n    }\r\n    catch (Exception ex)\r\n    {\r\n        log.Info($\"Bad invocation {ex.Message}\");\r\n    }    \r\n\r\n    return \"200\";\r\n}\r\n\r\n\r\n// Bringing the Object Graph into a types.csx file and loading it results in a successful deserialization\r\n\r\n// POCO from Entities.dll\r\npublic class EvaluationRequest \r\n{\r\n\t// Standard System.Guid\r\n\tpublic Guid Measure { get; set; }\t\t\r\n\t// Another object in the Entities DLL\r\n\tpublic Patient Patient { get; set; }\r\n\t// An Enum\t\t\r\n\tpublic Application ApplicationId { get; set; }\r\n\r\n\tpublic string ClientId { get; set; }\r\n}\r\n```\r\n\r\nProvide the steps required to reproduce the problem\r\n\r\n1. Create the function above\r\n2. Comment out the body of the try...catch block\r\n3. Execute function and the function succeeds and the log message is printed.\r\n4. Uncomment the try...catch block\r\n5. Execute the function and the exception is thrown, but no log message is printed (this makes us think it has something to do with the JIT compiler).\r\n\r\n#### Expected behavior\r\n\r\nThe string should be deserialized to the POCO.\r\n\r\n#### Actual behavior\r\n\r\n2017-05-16T18:51:10.477 Function started (Id=21f3f001-cab2-49ff-84b7-d531a5d667a5)\r\n2017-05-16T18:51:10.477 Unable to find assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Are you missing a private assembly file?\r\n2017-05-16T18:51:10.477 Function completed (Failure, Id=21f3f001-cab2-49ff-84b7-d531a5d667a5, Duration=2ms)\r\n\r\n#### Related information \r\n\r\nproject.json contents:\r\n```\r\n{\r\n\t\"dependencies\": {\r\n\t\t\"Newtonsoft.Json\" : \"10.0.2\"\r\n\t},\r\n\t\"frameworks\": {\r\n\t\t\"netcoreapp1.1\": {\r\n\t\t\t\r\n    \t}\r\n \t}\r\n}\r\n```\r\n* Programming language used \r\nC#, .csx, Azure Functions\r\n* Links to source\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Azure/azure-webjobs-sdk-script/issues/comments/301907170","html_url":"https://github.com/Azure/azure-webjobs-sdk-script/issues/1514#issuecomment-301907170","issue_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk-script/issues/1514","id":301907170,"user":{"login":"khariq","id":4582312,"avatar_url":"https://avatars3.githubusercontent.com/u/4582312?v=3","gravatar_id":"","url":"https://api.github.com/users/khariq","html_url":"https://github.com/khariq","followers_url":"https://api.github.com/users/khariq/followers","following_url":"https://api.github.com/users/khariq/following{/other_user}","gists_url":"https://api.github.com/users/khariq/gists{/gist_id}","starred_url":"https://api.github.com/users/khariq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khariq/subscriptions","organizations_url":"https://api.github.com/users/khariq/orgs","repos_url":"https://api.github.com/users/khariq/repos","events_url":"https://api.github.com/users/khariq/events{/privacy}","received_events_url":"https://api.github.com/users/khariq/received_events","type":"User","site_admin":false},"created_at":"2017-05-16T20:34:00Z","updated_at":"2017-05-16T20:34:00Z","body":"@fabiocav It is target .NetCore1.1  I changed the framework to 1.0 (which from my [understanding](https://docs.microsoft.com/en-us/dotnet/articles/standard/library) is in 1.3?) and the error still occurs.  I also deleted project.json to make sure the framework reference is gone."}}
{"actor":{"display_login":"khariq"}}