locked
Project broken after VS 2013 Crash - Critical errors in application definition metadata RRS feed

  • Question

  • VS2013 Pro version 12.0.21005.1 REL

    The project in question was created in VS2013, not upgrade or imported.  It has one data source, using the intrinsic database - no external database or sharepoint.  All the database design was done in Lightswitch designer.  By my estimation, a very clean, by the numbers Lightswitch project.

    I was working on my C# Lightswitch 2013 project when VS crashed on me.  When trying to reopen the project I get a message saying:

    There are critical errors in the application definition metadata.  Those errors must be loaded in the designer.
    Check the error in the error list window, and fix them in the text editor. Then click Reload.

    The error list shows this:

    Error 1 Root element is missing. C:\myapp\myapp.DesktopClient\Screens\myscreen.lsml 
    Error 2 Could not load the application definition. Root element of file is not a 'ModelFragment' or a module.

    I don't know how to recover.

    It may be coincidence but some updates did install just prior to the VS crash.  According to updates history, these were installed just prior:

    Security Update for Microsoft .NET Framework 3.5.1 on Windows 7 and Windows Server 2008 R2 SP1 for x64-based Systems (KB2901112)

    Update for Windows 7 for x64-based Systems (KB2919469)

    Security Update for Windows 7 for x64-based Systems (KB2916036)

    Security Update for Microsoft .NET Framework 4.5.1 on Windows 7, Vista, Server 2008, and Server 2008 R2 for x64 (KB2898869)

    Security Update for Microsoft .NET Framework 3.5.1 on Windows 7 and Windows Server 2008 R2 SP1 for x64-based Systems (KB2898857)

    Update for Windows 7 for x64-based Systems (KB2843630)

    Security Update for Microsoft .NET Framework 4.5.1 on Windows 7, Vista, Server 2008, and Server 2008 R2 for x64 (KB2901126)

    Security Update for Windows 7 for x64-based Systems (KB2862973)

    Security Update for Windows 7 for x64-based Systems (KB2912390)

    Security Update for Microsoft .NET Framework 3.5.1 on Windows 7 and Windows Server 2008 R2 SP1 for x64-based Systems (KB2911501)

    Security Update for Internet Explorer 11 for Windows 7 for x64-based Systems (KB2909210)

    Definition Update for Microsoft Security Essentials - KB2310138 (Definition 1.165.3928.0)


    • Edited by Bob Coder Thursday, February 13, 2014 1:42 AM
    Thursday, February 13, 2014 1:20 AM

Answers

  • Delete the links to the screen's files in the client project file. If it is Silverlight also check the client.lsml for navigation command and delete it.

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.


    • Edited by Xpert360 Thursday, February 13, 2014 10:05 PM
    • Marked as answer by Bob Coder Monday, February 17, 2014 6:44 PM
    Thursday, February 13, 2014 10:04 PM

All replies

  • HI Bob

    Thanks for your feedback.

    According to your description above, here are some suggestions for you.

    1. Repair your VS 2013 first,

    To repair Visual Studio

    • In Control Panel, on the Programs and Features page, choose the product edition that you want to repair, and then choose Uninstall/Change.
    • In the Setup wizard, choose Repair, choose Next, and then follow the remaining instructions.

    2. Cleaning and rebuilding your current Project (Right-click > Clean, Right-click Rebuild respective) and see if that makes any difference at all. 

    If it still has same issue, please let me know.

    hope it helps.

    Regards


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by Angie Xu Thursday, February 13, 2014 9:56 AM
    Thursday, February 13, 2014 9:55 AM
  • Followed the steps above, which did not resolve the issue.

    The repair was successful but my attempt to clean ran for a half hour before I had to end task on VS to get out.

    It appears that I have one model file for a screen that is blank (no text in file).  I can't delete it from my project.  I was editing this screen when VS crashed on my the first time. 

    Please advise on how I can recover.

    Bob


    Bob

    Thursday, February 13, 2014 9:23 PM
  • Delete the links to the screen's files in the client project file. If it is Silverlight also check the client.lsml for navigation command and delete it.

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.


    • Edited by Xpert360 Thursday, February 13, 2014 10:05 PM
    • Marked as answer by Bob Coder Monday, February 17, 2014 6:44 PM
    Thursday, February 13, 2014 10:04 PM
  • Dave,

    I was able to recover my project following your instructions.

    It turns out I had to delete three screens to get my project to load. I used the Error List (under the view menu) to show each screen that failed, and I deleted each according to your instructions.  It is a Silverlight project, and two of the three screens had entries in client.lsml that were deleted as per your instructions.

    After my project loaded, I did a clean, and then a rebuild.  No errors, I can now continue.

    Thanks again Dave for setting me on the right track.  Hope this post helps others.

    Bob


    Bob

    Monday, February 17, 2014 6:50 PM
  • Thanks for the advice Xpert360.

    However, in version 2012, I have a completely blank client.lsml file. I don't want to have to delete my screens because they have a lot of features built into them which would be a pain to re-create.

    I lost a couple days of work, but at this point I think I am just going to copy all of my code to my last backup and re-do some of the screen changes.

    Any suggestions on how to recover from this situation would be great though.

    Thursday, March 13, 2014 10:20 PM
  • I also encountered the "Root element is missing" error, after a Visual Studio crash. In my case it was for a file in the HTMLClient's Properties/ApplicationData folder (corresponding to a query called "Centers" I have in my app...the file is Properties/ApplicationData/Centers.lsml). I opened it and the file was blank, so I first tried copying one of the other lsml files in that folder but it didn't work...what finally worked was creating an lsml file without the <EntityType> section:

    <?xml version="1.0" encoding="utf-8"?> <Application Name="LightSwitchApplication.MyProject.HTMLClient" xmlns="http://schemas.microsoft.com/LightSwitch/2010/xaml/model"> <Application.Attributes> <Partial /> </Application.Attributes> </Application>

    (Replace "MyProject" with your project name.)

    I think the "Root element is missing" error described in the initial post here may be a different issue, but I thought I'd post my experience in case it helps someone.

    Although it did not help me personally, this thread may also be relevant:

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/f869cf45-998c-494f-b67d-e9250b21ecd8/my-number-one-wish-for-a-lightswitch-enhancement?forum=lightswitch

    This could have been avoided if I had been able to restore from a good backup, but unfortunately I made the mistake of thinking that the "Commit" command in Visual Studio's version control was sufficient to ensure that all files were committed...apparently not. There were a lot of files I thought I was committing to Git but apparently wasn't - so be careful to test that your repository contains everything you think it does if you're using Git! To be on the safe side I'll be using git from the command line from now on...

    Bottom line: make sure you keep good backups, because recovering a Lightswitch app after a Visual Studio crash without a 100% complete backup can be difficult or impossible!

    Wednesday, September 16, 2015 8:54 PM
  • I I know this could be quite old, but I had this issue a couple of days ago, and solve it in a differente way.

    This error happened after a VS13 crash, just in the moment when I was renaming an screen.

    For some reason, VS was not abble to rename .LSML and  VS C# (under Client\Screens) to the new name, so there was a missmatch between files and screen object in VS client project.

    The solution was to renamen this two files to the previous one before the VS2013 crash. Whit this done, my LS2013 project loaded flawless.

    Best regard

    Raul
    Friday, August 4, 2017 3:32 PM