{"action":"created","issue":{"url":"https://api.github.com/repos/OpenRIAServices/TestIssues/issues/53","labels_url":"https://api.github.com/repos/OpenRIAServices/TestIssues/issues/53/labels{/name}","comments_url":"https://api.github.com/repos/OpenRIAServices/TestIssues/issues/53/comments","events_url":"https://api.github.com/repos/OpenRIAServices/TestIssues/issues/53/events","html_url":"https://github.com/OpenRIAServices/TestIssues/issues/53","id":127332858,"number":53,"title":"Control timing of generation of Generated\\_Code ","user":{"login":"STAH","id":2418242,"avatar_url":"https://avatars.githubusercontent.com/u/2418242?v=3","gravatar_id":"","url":"https://api.github.com/users/STAH","html_url":"https://github.com/STAH","followers_url":"https://api.github.com/users/STAH/followers","following_url":"https://api.github.com/users/STAH/following{/other_user}","gists_url":"https://api.github.com/users/STAH/gists{/gist_id}","starred_url":"https://api.github.com/users/STAH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/STAH/subscriptions","organizations_url":"https://api.github.com/users/STAH/orgs","repos_url":"https://api.github.com/users/STAH/repos","events_url":"https://api.github.com/users/STAH/events{/privacy}","received_events_url":"https://api.github.com/users/STAH/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/OpenRIAServices/TestIssues/labels/CodePlex","name":"CodePlex","color":"ededed"},{"url":"https://api.github.com/repos/OpenRIAServices/TestIssues/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-01-18T23:45:48Z","updated_at":"2016-01-18T23:45:49Z","closed_at":null,"body":"<sub>This issue was imported from [CodePlex](http://openriaservices.codeplex.com/workitem/53)</sub>\r\n\r\n**[groovejumper](https://github.com/groovejumper)** <sup>wrote 2014-10-10 at 22:34</sup>\r\nI posted this on the other site but perhaps was in the wrong spot, so I will try here:\r\n\r\nThis is an issue that existed with WCF RIA as well - Visual Studio seems to trigger creating the Generated\\_Code far too often. For example, editing some XAML in the designer, then clicking on the design surface or opening another .xaml file. This happens if there are unsaved changes to any XAML. Saving those changes will also regenerate the OpenRiaServices client code, but then it's possible to move around without the constant rebuilds.\r\n\r\nIt would seem to me that changing the model or domain service should *maybe* do this, however only if it would include, for example, a new query method in the domain service - but that's not the case, even when the Generated\\_Code is rebuilt it does not include changes to the Domain Service until the project is built. \r\n\r\nWe have a fairly large data model (260+ tables, a handful of views and sprocs as well), which results in a generated code file >5MB, and takes a good 6-7 seconds to generate which is a bit frustrating as I don't think it really needs to be doing that when I edit XAML... \r\n\r\nIs there any way to control this behavior?"},"comment":{"url":"https://api.github.com/repos/OpenRIAServices/TestIssues/issues/comments/172683837","html_url":"https://github.com/OpenRIAServices/TestIssues/issues/53#issuecomment-172683837","issue_url":"https://api.github.com/repos/OpenRIAServices/TestIssues/issues/53","id":172683837,"user":{"login":"STAH","id":2418242,"avatar_url":"https://avatars.githubusercontent.com/u/2418242?v=3","gravatar_id":"","url":"https://api.github.com/users/STAH","html_url":"https://github.com/STAH","followers_url":"https://api.github.com/users/STAH/followers","following_url":"https://api.github.com/users/STAH/following{/other_user}","gists_url":"https://api.github.com/users/STAH/gists{/gist_id}","starred_url":"https://api.github.com/users/STAH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/STAH/subscriptions","organizations_url":"https://api.github.com/users/STAH/orgs","repos_url":"https://api.github.com/users/STAH/repos","events_url":"https://api.github.com/users/STAH/events{/privacy}","received_events_url":"https://api.github.com/users/STAH/received_events","type":"User","site_admin":false},"created_at":"2016-01-18T23:45:48Z","updated_at":"2016-01-18T23:45:48Z","body":"**[groovejumper](https://github.com/groovejumper)** <sup>wrote 2014-10-19 at 19:02</sup>\r\nSo I think I found the source of this issue, though not exactly sure how to troubleshoot/debug/solve it.\r\n\r\nOpenRiaServices (and Ria Services before it) writes out a list of server project assembly references to a .txt file in the client project's obj folder.\r\n\r\nThat file contains relative paths to assemblies located within the project, and absolute paths to assemblies elsewhere in the file system, along with the last write time of each file.\r\n\r\nThe CreateOpenRiaClientFilesTask, along with being executed when building, is also executed when loading the project in Visual Studio, and when making certain types of changes. Visual Studio appears to want to execute this task when changing between XAML files with unsaved changes, or even clicking between XAML source and the designer (not sure why), which, under normal circumstances should not be a problem, as the Task will use the logged last write times to compare to the existing files, and if they match, it won't generate any code (as nothing's changed to cause a re-generation).\r\n\r\nHere's the issue - while the assemblies located \"elsewhere in the file system\" properly have their last write time recorded, the relative-pathed local assemblies do not. On my setup, they all get 12/31/1600 19:00:00, and according to the documentation for File.GetLastWriteTime(), \"If the file described in the path parameter does not exist, this method returns 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC), adjusted to local time.\" GMT-5 (my timezone) results in the timestamps I'm seeing, and since they never match the actual write times, code gets generated ALL THE TIME, and with large-ish domain services it makes for a poor developer experience.\r\n\r\nBy manually editing the .txt file and replacing the incorrect date with the real last write time, everything works as expected, and the IDE experience is MUCH better.\r\n\r\nI'm not sure how to debug an MSBUILD task, so I'm not really sure how to solve this. I suppose by using a hammer I could execute a post-build script, or write a Task run in the AfterOpenRiaClientCodeGen Target (which actually may be a good solution for our projects still using Ria Services) which would completely re-write the .txt files with proper values, but a better solution would be to determine why exactly the existing CreateOpenRiaClientFilesTask can't write the actual write time of local assembly references - I'd probably start by looking at the code in WriteReferenceList (but again, not sure how to debug this...)\r\n\r\nAny thoughts or direction would be greatly appreciated!\r\n"}}