{"action":"created","issue":{"url":"https://api.github.com/repos/SitecorePowerShell/Console/issues/696","repository_url":"https://api.github.com/repos/SitecorePowerShell/Console","labels_url":"https://api.github.com/repos/SitecorePowerShell/Console/issues/696/labels{/name}","comments_url":"https://api.github.com/repos/SitecorePowerShell/Console/issues/696/comments","events_url":"https://api.github.com/repos/SitecorePowerShell/Console/issues/696/events","html_url":"https://github.com/SitecorePowerShell/Console/issues/696","id":174831672,"number":696,"title":"Type initializer exception when executing script via WebAPI","user":{"login":"alan-null","id":6848691,"avatar_url":"https://avatars.githubusercontent.com/u/6848691?v=3","gravatar_id":"","url":"https://api.github.com/users/alan-null","html_url":"https://github.com/alan-null","followers_url":"https://api.github.com/users/alan-null/followers","following_url":"https://api.github.com/users/alan-null/following{/other_user}","gists_url":"https://api.github.com/users/alan-null/gists{/gist_id}","starred_url":"https://api.github.com/users/alan-null/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alan-null/subscriptions","organizations_url":"https://api.github.com/users/alan-null/orgs","repos_url":"https://api.github.com/users/alan-null/repos","events_url":"https://api.github.com/users/alan-null/events{/privacy}","received_events_url":"https://api.github.com/users/alan-null/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/SitecorePowerShell/Console/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-02T19:27:24Z","updated_at":"2016-09-14T22:04:42Z","closed_at":null,"body":"### Steps to Reproduce the Problem\r\n1. Add new Module with `Web API` integration point\r\n2. Add new script under Web API folder (let's say name will be: Foo)\r\n3. Insert following content \r\n```powershell\r\n$pck = New-Package -Name \"PckgName\"\r\nExport-Package $pck\r\n```\r\n**Now, kill your instance**\r\nAfter that call following URL:\r\n`http://domain/-/script/v2/master/Foo?user=admin&password=b`\r\n\r\n### Expected Behavior \r\nScript executed, without any errors\r\n\r\n### Actual Behavior\r\nYou will get following error as an API response:\r\n```\r\nExport-Package : The type initializer for 'Sitecore.Install.Serialization.IOUtils' threw an exception.\r\nAt line:3 char:1\r\n+ Export-Package $pck\r\n+ ~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : NotSpecified: (:) [Export-Package], TypeInitializationException\r\n    + FullyQualifiedErrorId : System.TypeInitializationException,Cognifide.PowerShell.Commandlets.Packages.ExportPackageCommand\r\n``` \r\n\r\nAfter these steps you will not be able to execute `Export-Package` anywhere\r\n\r\n### Additional notes:\r\nVery important here is fact that first thing you do after restart is Web API call.\r\nIf you turn instance off and on again and before calling script via Web API execute the script body from ISE, then everything will work fine.\r\n"},"comment":{"url":"https://api.github.com/repos/SitecorePowerShell/Console/issues/comments/247170628","html_url":"https://github.com/SitecorePowerShell/Console/issues/696#issuecomment-247170628","issue_url":"https://api.github.com/repos/SitecorePowerShell/Console/issues/696","id":247170628,"user":{"login":"AlexKasaku","id":1439631,"avatar_url":"https://avatars.githubusercontent.com/u/1439631?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexKasaku","html_url":"https://github.com/AlexKasaku","followers_url":"https://api.github.com/users/AlexKasaku/followers","following_url":"https://api.github.com/users/AlexKasaku/following{/other_user}","gists_url":"https://api.github.com/users/AlexKasaku/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexKasaku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexKasaku/subscriptions","organizations_url":"https://api.github.com/users/AlexKasaku/orgs","repos_url":"https://api.github.com/users/AlexKasaku/repos","events_url":"https://api.github.com/users/AlexKasaku/events{/privacy}","received_events_url":"https://api.github.com/users/AlexKasaku/received_events","type":"User","site_admin":false},"created_at":"2016-09-14T22:04:42Z","updated_at":"2016-09-14T22:04:42Z","body":"This is due to the constructor of the `Sitecore.Install.Configuration.InstallerObjectFactory` type, which appears to be expecting to be instantiated when the current Database context is `core`, rather than `master`."}}
{"actor":{"display_login":"AlexKasaku"}}