{"action":"closed","issue":{"url":"https://api.github.com/repos/JimBobSquarePants/ImageProcessor/issues/164","labels_url":"https://api.github.com/repos/JimBobSquarePants/ImageProcessor/issues/164/labels{/name}","comments_url":"https://api.github.com/repos/JimBobSquarePants/ImageProcessor/issues/164/comments","events_url":"https://api.github.com/repos/JimBobSquarePants/ImageProcessor/issues/164/events","html_url":"https://github.com/JimBobSquarePants/ImageProcessor/issues/164","id":73912405,"number":164,"title":"invalidoperationexception on autoprocess","user":{"login":"Deidarius","id":7248302,"avatar_url":"https://avatars.githubusercontent.com/u/7248302?v=3","gravatar_id":"","url":"https://api.github.com/users/Deidarius","html_url":"https://github.com/Deidarius","followers_url":"https://api.github.com/users/Deidarius/followers","following_url":"https://api.github.com/users/Deidarius/following{/other_user}","gists_url":"https://api.github.com/users/Deidarius/gists{/gist_id}","starred_url":"https://api.github.com/users/Deidarius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Deidarius/subscriptions","organizations_url":"https://api.github.com/users/Deidarius/orgs","repos_url":"https://api.github.com/users/Deidarius/repos","events_url":"https://api.github.com/users/Deidarius/events{/privacy}","received_events_url":"https://api.github.com/users/Deidarius/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JimBobSquarePants/ImageProcessor/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-05-07T09:20:37Z","updated_at":"2015-05-27T14:50:10Z","closed_at":"2015-05-27T14:50:10Z","body":"/* This will run as a webjob. It will update all images on the storage, to ensure that they all have an image copy in of the presets. There will be a raw image, which the others are manipulated from. It all works fine, until it reaches the imagefactory.autoprocess. It throws the exception: InvalidOperationException method cannot be called during the application's pre-start initialization phase, and I don't know why */\r\n\r\n\r\n[NoAutomaticTrigger]\r\n        public static void UpdatePresetsBlob()\r\n        {\r\n            \r\n                using (var presetStream = new MemoryStream())\r\n                {\r\n                    var rawBlob = container.GetBlockBlobReference(folder + \"/Raw\" + extension);\r\n                    rawBlob.DownloadToStream(presetStream);\r\n                    presetStream.Seek(0, SeekOrigin.Begin);\r\n\r\n                foreach (var jtoken in jarray)\r\n                {\r\n                      var imageElement = (from e in presetDoc.Root.Elements(\"Preset\")\r\n                                        where e.Attribute(\"Name\").Value == presetName\r\n                                        select e).FirstOrDefault();\r\n                        \r\n                         using (var outStream = new MemoryStream())\r\n                                {\r\n                                    imageFactory.Load(presetStream)\r\n                                                .AutoProcess(\"width=200&height=200&bgcolor=transparent\")\r\n                                                .Save(outStream);\r\n\r\n                                    outStream.Seek(0, SeekOrigin.Begin);\r\n\r\n                                    var presetPath = folder + presetName + format;\r\n                                    var image = container.GetBlockBlobReference(presetName);\r\n                                    image.UploadFromStream(outStream);\r\n                                }\r\n                                \r\n                        }\r\n                    \r\n                    }\r\n}"}}