Data Access Service Wizard Locks Visual Studio

4 posts, 1 answers
  1. Paul
    Paul avatar
    17 posts
    Member since:
    May 2011

    Posted 09 Sep 2014 Link to this post

    I recently upgraded to the latest version of Data Access (Q2 2014 SP1), hoping this issue had been resolved, but it does not yet appear to be.  I have found references to it in the past, but the last time someone mentioned it in regards to the Data Service wizard the discussion did not seem to go anywhere.

    Here is my scenario:

    I have a web application under source control (TFS) that I am developing in Visual Studio 2012.  I launch the Data Service Wizard by right-clicking on the project and selecting "Add Data Access Service...".  The wizard proceeds normally, and my classes are generated as expected.  Unfortunately, if the wizard needs to perform any operations that involve a source control operation (add file, check out file, etc), Visual Studio enters a "pseudo-locked" state - typing in the text editor works, but all "special" keys stop working (such as Ctrl, Alt, and Backspace).

    If Visual Studio enters this state, I have to restart it to restore normal functionality.  When I try to shut it down, I receive this prompt:

    ---------------------------
    Microsoft Visual Studio
    ---------------------------
    Microsoft Visual Studio has detected that an operation is blocking user input.  This can be caused by an active modal dialog or a task that needs to block user interaction.  Would you like to shut down anyway?
    ---------------------------
    Yes   No   
    ---------------------------

    I'm using a Fluent model.  If I check out the files I expect to be modified before I run the wizard, the issue does not arise.  This is an acceptable workaround for many scenarios, but it does not help if I've added a new entity to my model, as an "add" operation by the wizard will still cause this issue.

    I know this issue used to affect the model designer interface, and the recommendation was to disable the T4 security prompt.  I have disabled this prompt to no effect.  I would appreciate any other suggestions on how to avoid this issue.
  2. Kristian Nikolov
    Admin
    Kristian Nikolov avatar
    206 posts

    Posted 12 Sep 2014 Link to this post

    Hi Paul,

    Thank you for contacting us.

    The behavior you are experiencing is a known issue. In my answer I will explain why this problem appears and how you can avoid it.

    The Service Wizard not only creates new files but also modifies existing files. Generally this is the case with Global.asax and Web.config files when creating a service for the first time. Multiple existing files are also modified when you regenerate an existing service. Normally if the files which are modified have been opened in Visual Studio, you will see a dialog asking you whether you wish to reload them. However as the Service Wizard modifies the files in a background thread, sometimes this dialog will sometimes not show causing you to experience the behavior you have described. Please note that this behavior is rather inconsistent and will not always occur even if the conditions for it are met. We have addressed the issue previously reducing the rate at which it arises however the problem will still sometimes surface.

    As the issue arises only in a scenario where files which the wizard will modify have been opened in Visual Studio prior to running the wizard, the recommended workaround is to close all existing files which the wizard will edit before running it.

    I hope this helps. Should you have further questions feel free to post in our forums again.

    Regards,
    Kristian Nikolov
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
  3. DevCraft banner
  4. Paul
    Paul avatar
    17 posts
    Member since:
    May 2011

    Posted 12 Sep 2014 in reply to Kristian Nikolov Link to this post

    Hi Kristian,

    Thanks for getting back to me.  Based on your explanation of the problem, I think I may be describing a new variation on your known issue.  In my scenario, Visual Studio will consistently enter a locked state - even if every file in the solution is closed.

    I just ran a simple test scenario with some careful steps to reproduce the issue.
    1. Get the latest version of all the files from source control.
    2. I closed every file in my solution.
    3. I shut down Visual Studio and restarted it.
    4. I opened my solution.  Because I had previously closed every file in the solution, no files opened by default.
    5. I right-clicked on my web service project and selected "Add Telerik Data Access Service"
    6. I proceeded through the wizard to generate my files.
    7. Visual studio enters its locked state.

    I attribute the problem to placing my solution under source control.  Prior to adding my solution to source control, I did not encounter this issue.  If I prepare for running the code wizard by checking out every file that might be modified (Web.config, etc), the issue does not arise.  Unfortunately (I'm not sure if this is a function of Visual Studio or the Code Generator), the checkout is automatically undone if there were no changes to the file.  So to avoid the issue I must check out every generated file prior to every execution of the Code Generator.

    Based on the fact my experience is consistent and unconnected to whether a file is open or not, I believe I am describing a different issue, or at least a variation on the existing issue.  Is there any way to avoid/automate checking out files prior to every run of the Code Generator?

  5. Answer
    Kristian Nikolov
    Admin
    Kristian Nikolov avatar
    206 posts

    Posted 16 Sep 2014 Link to this post

    Hi Paul,

    Thank you for getting back to us with this additional information.

    We managed to reproduce the described behavior. Indeed this appears to be a new  bug in Telerik Data Access. We have logged the issue in our system for prioritization. Please accept our apologies for the caused inconvenience and find your Telerik Points updated for reporting the problem.

    Regarding a workaround for this behavior the only applicable approach appears to be checking out the files that would be affected by the code generation prior to running the wizard. Regarding automating the process of checking out the files, you could consider using the Workspace.PendEdit method from the TFS client API to create a small tool that checks out the required files. Alternatively you could create a script of commands to achieve the same goal. Note that you will have to run the tool or script that checks out the files manually prior to running the Service Wizard.

    As for a checkout being undone, this does not appear to be a functionality of the Service Wizard or the code generation logic.

    I hope this helps. In case you have additional questions feel free to post at our forums again.

    Regards,
    Kristian Nikolov
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
Back to Top