{"action":"created","issue":{"url":"https://api.github.com/repos/Starcounter/Starcounter/issues/2762","labels_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/2762/labels{/name}","comments_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/2762/comments","events_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/2762/events","html_url":"https://github.com/Starcounter/Starcounter/issues/2762","id":86574230,"number":2762,"title":"Invalid Session scope inside Hook<T>.OnAction","user":{"login":"miyconst","id":6435556,"avatar_url":"https://avatars.githubusercontent.com/u/6435556?v=3","gravatar_id":"","url":"https://api.github.com/users/miyconst","html_url":"https://github.com/miyconst","followers_url":"https://api.github.com/users/miyconst/followers","following_url":"https://api.github.com/users/miyconst/following{/other_user}","gists_url":"https://api.github.com/users/miyconst/gists{/gist_id}","starred_url":"https://api.github.com/users/miyconst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miyconst/subscriptions","organizations_url":"https://api.github.com/users/miyconst/orgs","repos_url":"https://api.github.com/users/miyconst/repos","events_url":"https://api.github.com/users/miyconst/events{/privacy}","received_events_url":"https://api.github.com/users/miyconst/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Starcounter/Starcounter/labels/bug","name":"bug","color":"e11d21"},{"url":"https://api.github.com/repos/Starcounter/Starcounter/labels/in-progress","name":"in-progress","color":"DDDDDD"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-06-09T12:06:08Z","updated_at":"2015-06-10T12:35:01Z","closed_at":null,"body":"Two applications `SignIn` and `GoogleSignIn`, each application uses `Session.Current.Data` to save ViewModel instance and update it's state when user signs in/out.\r\n\r\nWhen user signs in with `SignIn` app it creates a new `SystemUserSession` and then in `GoogleSignIn`:\r\n```csharp\r\nHook<SystemUserSession>.OnInsert(s => {\r\n    //In here Session.Current.Data equals to SignIn.SessionContainer\r\n    //And StarcounterEnvironment.AppName equals to \"SignIn\", but should be \"GoogleSignIn\"\r\n});\r\n```\r\n\r\nThe `SignIn.SessionContainer` class is defined and set to Session in `SignIn` app, but visible in `GoogleSignIn` app.\r\n\r\nIf I manually change \r\n```csharp\r\nStarcounterEnvironment.AppName = \"GoogleSignIn\";\r\n```\r\nThen `Session.Current` has correct value, but as @alemoi said `StarcounterEnvironment.AppName` should be readonly and currently exposed only for test reasons.\r\n\r\nThe changes are not pushed yet, I can push or demonstrate on my pc if needed.\r\n"},"comment":{"url":"https://api.github.com/repos/Starcounter/Starcounter/issues/comments/110732861","html_url":"https://github.com/Starcounter/Starcounter/issues/2762#issuecomment-110732861","issue_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/2762","id":110732861,"user":{"login":"miyconst","id":6435556,"avatar_url":"https://avatars.githubusercontent.com/u/6435556?v=3","gravatar_id":"","url":"https://api.github.com/users/miyconst","html_url":"https://github.com/miyconst","followers_url":"https://api.github.com/users/miyconst/followers","following_url":"https://api.github.com/users/miyconst/following{/other_user}","gists_url":"https://api.github.com/users/miyconst/gists{/gist_id}","starred_url":"https://api.github.com/users/miyconst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miyconst/subscriptions","organizations_url":"https://api.github.com/users/miyconst/orgs","repos_url":"https://api.github.com/users/miyconst/repos","events_url":"https://api.github.com/users/miyconst/events{/privacy}","received_events_url":"https://api.github.com/users/miyconst/received_events","type":"User","site_admin":false},"created_at":"2015-06-10T12:35:01Z","updated_at":"2015-06-10T12:35:01Z","body":"Also twice. Maybe the `OnInsert` method counts number of calls and does different logic depending on that ))"}}