{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/azure-webjobs-sdk-script/issues/569","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/569/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk-script/issues/569/comments","events_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk-script/issues/569/events","html_url":"https://github.com/Azure/azure-webjobs-sdk-script/issues/569","id":170694885,"number":569,"title":"Locking issue with DLLs in Functions","user":{"login":"richardagreene","id":77116,"avatar_url":"https://avatars.githubusercontent.com/u/77116?v=3","gravatar_id":"","url":"https://api.github.com/users/richardagreene","html_url":"https://github.com/richardagreene","followers_url":"https://api.github.com/users/richardagreene/followers","following_url":"https://api.github.com/users/richardagreene/following{/other_user}","gists_url":"https://api.github.com/users/richardagreene/gists{/gist_id}","starred_url":"https://api.github.com/users/richardagreene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richardagreene/subscriptions","organizations_url":"https://api.github.com/users/richardagreene/orgs","repos_url":"https://api.github.com/users/richardagreene/repos","events_url":"https://api.github.com/users/richardagreene/events{/privacy}","received_events_url":"https://api.github.com/users/richardagreene/received_events","type":"User","site_admin":false},"labels":[{"id":378017356,"url":"https://api.github.com/repos/Azure/azure-webjobs-sdk-script/labels/improvement","name":"improvement","color":"1d76db","default":false}],"state":"open","locked":false,"assignee":{"login":"christopheranderson","id":2252976,"avatar_url":"https://avatars.githubusercontent.com/u/2252976?v=3","gravatar_id":"","url":"https://api.github.com/users/christopheranderson","html_url":"https://github.com/christopheranderson","followers_url":"https://api.github.com/users/christopheranderson/followers","following_url":"https://api.github.com/users/christopheranderson/following{/other_user}","gists_url":"https://api.github.com/users/christopheranderson/gists{/gist_id}","starred_url":"https://api.github.com/users/christopheranderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christopheranderson/subscriptions","organizations_url":"https://api.github.com/users/christopheranderson/orgs","repos_url":"https://api.github.com/users/christopheranderson/repos","events_url":"https://api.github.com/users/christopheranderson/events{/privacy}","received_events_url":"https://api.github.com/users/christopheranderson/received_events","type":"User","site_admin":false},"assignees":[{"login":"christopheranderson","id":2252976,"avatar_url":"https://avatars.githubusercontent.com/u/2252976?v=3","gravatar_id":"","url":"https://api.github.com/users/christopheranderson","html_url":"https://github.com/christopheranderson","followers_url":"https://api.github.com/users/christopheranderson/followers","following_url":"https://api.github.com/users/christopheranderson/following{/other_user}","gists_url":"https://api.github.com/users/christopheranderson/gists{/gist_id}","starred_url":"https://api.github.com/users/christopheranderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christopheranderson/subscriptions","organizations_url":"https://api.github.com/users/christopheranderson/orgs","repos_url":"https://api.github.com/users/christopheranderson/repos","events_url":"https://api.github.com/users/christopheranderson/events{/privacy}","received_events_url":"https://api.github.com/users/christopheranderson/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/Azure/azure-webjobs-sdk-script/milestones/4","html_url":"https://github.com/Azure/azure-webjobs-sdk-script/milestones/Next%20-%20Triaged","labels_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk-script/milestones/4/labels","id":1682707,"number":4,"title":"Next - Triaged","description":"Work for the next iteration","creator":{"login":"christopheranderson","id":2252976,"avatar_url":"https://avatars.githubusercontent.com/u/2252976?v=3","gravatar_id":"","url":"https://api.github.com/users/christopheranderson","html_url":"https://github.com/christopheranderson","followers_url":"https://api.github.com/users/christopheranderson/followers","following_url":"https://api.github.com/users/christopheranderson/following{/other_user}","gists_url":"https://api.github.com/users/christopheranderson/gists{/gist_id}","starred_url":"https://api.github.com/users/christopheranderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christopheranderson/subscriptions","organizations_url":"https://api.github.com/users/christopheranderson/orgs","repos_url":"https://api.github.com/users/christopheranderson/repos","events_url":"https://api.github.com/users/christopheranderson/events{/privacy}","received_events_url":"https://api.github.com/users/christopheranderson/received_events","type":"User","site_admin":false},"open_issues":93,"closed_issues":41,"state":"open","created_at":"2016-04-04T18:21:33Z","updated_at":"2016-11-29T22:06:21Z","due_on":null,"closed_at":null},"comments":7,"created_at":"2016-08-11T16:59:45Z","updated_at":"2016-11-30T00:42:21Z","closed_at":null,"body":"I'm having issues of files locking within a Functions App, that is preventing Continuous Delivery.  The issue presents itself when referencing a .NET DLL within the function, running a test, then attempting to deploy a new version of the referenced .NET DLL.\n\nHere are the steps needed to replicate the issue:\n1) Create a simple class library in Visual Studio called \"FunctionsTest.Calculation\" and build. \n\n``` c#\nusing System;\nusing System.Text;\nnamespace FunctionsTest.Calculation\n{\n    public class SomeWork\n    {\n        public string Execute(string inputTest)\n        {\n            return String.Format(\"result {0}\", inputTest);\n        }\n    }\n}\n```\n\n2) Create a new Functions App\n3) Create a new Manually triggered C# Function called \"ManualTriggerCSharp1\", with the following code\n\n``` c#\n#r \"FunctionsTest.Calculation.dll\"\nusing System;\nusing FunctionsTest.Calculation;\n\npublic static void Run(string input, TraceWriter log)\n{\n    log.Info($\"C# manually triggered function called with input: {input}\");\n    var somework = new SomeWork();\n    var result = somework.Execute(input);\n    log.Info(\"result:\" + result );\n}\n```\n\n4) Upload a copy of the generated DLL to the BIN directory of the Function App using FTP\n5) Run the function .. all should execute correctly.\n6) Change the return parameter type of the method \"Execute\" within the local class library and rebuild the DLL.\n\n``` c#\nusing System;\nusing System.Text;\n\nnamespace FunctionsTest.Calculation\n{\n    public class SomeWork\n    {\n        public double Execute(string inputTest)\n        {\n            return 1f;\n        }\n    }\n}\n```\n\n7) Attempting to FTP the new DLL to Azure returns:\n     Command: STOR FunctionsTest.Calculation.dll\n     Response: 550 The process cannot access the file because it is being used by another process.\nWait a while, then try again ... wait again.. do this a few few times and you should get the same error.\n8) Eventually, when you get tired of waiting, rename your locally generated DLL file to something else for example \"FunctionsTest.Calculation1.dll\" and FTP that to the server.  This should work fine, so you now have two DLLs in the BIN directory.\n9) Update the reference in the Function script to point to the _new_ DLL (note line: **#r \"FunctionsTest.Calculation1.dll\" *\\* but continue to use _old_ namespace **using FunctionsTest.Calculation**).\n\n``` c#\n#r \"FunctionsTest.Calculation1.dll\"\nusing System;\nusing FunctionsTest.Calculation;\n\npublic static void Run(string input, TraceWriter log)\n{\n    log.Info($\"C# manually triggered function called with input: {input}\");\n    var somework = new SomeWork();\n    var result = somework.Execute(input);\n    log.Info(\"result:\" + result );\n}\n```\n\n10) Run the script again and you get the error, showing the function is still working against the _old_ DLL reference, even after modifying the code:\n\n> Exception while executing function: Functions.ManualTriggerCSharp1.\n> mscorlib: Exception has been thrown by the target of an invocation.\n> Method not found: 'Double \n> FunctionsTest.Calculation.SomeWork.Execute(System.String)'.\n\n11) Change the namespace in Visual Studio of the local DLL to \"FunctionsTest.Calculation1\", rebuild and FTP to the server under the filename \"FunctionsTest.Calculation1.dll\".\n12) Change the Function to use the _new_ namespace (note line: **using FunctionsTest.Calculation1**) and success, we're up and running again.\n\n``` c#\n#r \"FunctionsTest.Calculation1.dll\"\nusing System;\nusing FunctionsTest.Calculation1;\npublic static void Run(string input, TraceWriter log)\n{\n    log.Info($\"C# manually triggered function called with input: {input}\");\n    var somework = new SomeWork();\n    var result = somework.Execute(input);\n    log.Info(\"result:\" + result );\n}\n```\n\nThis is perhaps a edge case; however it does seem to indicate that Functions are holding on to references to external resources, even after a shutdown/restart or recompile.  With CI we are updating these DLLs continually and it's a drawback that we can't simply update the files.\n"},"comment":{"url":"https://api.github.com/repos/Azure/azure-webjobs-sdk-script/issues/comments/263747609","html_url":"https://github.com/Azure/azure-webjobs-sdk-script/issues/569#issuecomment-263747609","issue_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk-script/issues/569","id":263747609,"user":{"login":"ashelley","id":3195045,"avatar_url":"https://avatars.githubusercontent.com/u/3195045?v=3","gravatar_id":"","url":"https://api.github.com/users/ashelley","html_url":"https://github.com/ashelley","followers_url":"https://api.github.com/users/ashelley/followers","following_url":"https://api.github.com/users/ashelley/following{/other_user}","gists_url":"https://api.github.com/users/ashelley/gists{/gist_id}","starred_url":"https://api.github.com/users/ashelley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashelley/subscriptions","organizations_url":"https://api.github.com/users/ashelley/orgs","repos_url":"https://api.github.com/users/ashelley/repos","events_url":"https://api.github.com/users/ashelley/events{/privacy}","received_events_url":"https://api.github.com/users/ashelley/received_events","type":"User","site_admin":false},"created_at":"2016-11-30T00:42:21Z","updated_at":"2016-11-30T00:42:21Z","body":"@davidebbo i actually lied about this being successful... it does let me update the files.. however... to get the assembly to reload i think i have to `touch function.json` to get it to reload the assemblies"}}
{"actor":{"display_login":"ashelley"}}