locked
The "GetConnectionStrings" task failed unexpectedly RRS feed

  • Question

  • Hi,

    After adding a resource file to my project I keep getting this error randomly & I have to close Visual Studio & reopen it to get the project build. I've  cleaned the solution & built it but that hasn't help.

    Here is the error detail:

    Error 24 The "GetConnectionStrings" task failed unexpectedly.
    Microsoft.LightSwitch.BaseServices.InternalException: Model loading failed. Cannot cast the underlying exported value of type 'Microsoft.LightSwitch.Extensions.Metadata.ExtensionsModuleLoader (ContractName="Microsoft.LightSwitch.Model.IModuleDefinitionLoader")' to type 'Microsoft.LightSwitch.Model.IModuleDefinitionLoader'. ---> System.ComponentModel.Composition.CompositionContractMismatchException: Cannot cast the underlying exported value of type 'Microsoft.LightSwitch.Extensions.Metadata.ExtensionsModuleLoader (ContractName="Microsoft.LightSwitch.Model.IModuleDefinitionLoader")' to type 'Microsoft.LightSwitch.Model.IModuleDefinitionLoader'.
       at System.ComponentModel.Composition.ExportServices.CastExportedValue[T](ICompositionElement element, Object exportedValue)
       at System.ComponentModel.Composition.ExportServices.GetCastedExportedValue[T](Export export)
       at System.ComponentModel.Composition.ExportServices.<>c__DisplayClass4`2.<CreateStronglyTypedLazyOfTM>b__1()
       at System.Lazy`1.CreateValue()
       at System.Lazy`1.LazyInitValue()
       at System.Lazy`1.get_Value()
       at Microsoft.LightSwitch.Model.Implementation.ModelServiceBase.<get_ModuleLoaderExports>b__9(Lazy`2 ex)
       at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
       at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
       at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
       at Microsoft.LightSwitch.Model.Implementation.ModelServiceBase.get_ModuleLoaderExports()
       at Microsoft.LightSwitch.Model.Implementation.ModelServiceBase.LoadItems()
       --- End of inner exception stack trace ---
       at Microsoft.LightSwitch.Model.Implementation.ModelServiceBase.LoadItems()
       at Microsoft.LightSwitch.Model.Implementation.ModelServiceBase.get_Modules()
       at Microsoft.LightSwitch.BuildTasks.DataSources.DataSourcesBaseTask.get_ServiceApplicationDefinition()
       at Microsoft.LightSwitch.BuildTasks.DataSources.GetConnectionStrings.ExecuteCore()
       at Microsoft.LightSwitch.BuildTasks.Common.BuildTask.Execute()
       at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
       at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v4.5\Microsoft.LightSwitch.targets 184 10 TempIDTouch


    Divyang Vyas


    • Edited by divyang_dv Thursday, November 27, 2014 4:25 PM
    Thursday, November 27, 2014 4:22 PM

Answers

  • This problem is sorted in VS 2015.

    Divyang Vyas

    • Marked as answer by divyang_dv Tuesday, August 11, 2015 1:27 PM
    Tuesday, August 11, 2015 1:27 PM

All replies

  • If you want to localize a lightswitch application through add resource file

    you'll create a resource file for the default language and one for the localized language. You can localize an application even if it has only one type of client.

    more check:

    http://msdn.microsoft.com/en-us/library/xx130603.aspx

    Friday, November 28, 2014 5:23 AM
  • If you want to localize a lightswitch application through add resource file

    you'll create a resource file for the default language and one for the localized language. You can localize an application even if it has only one type of client.

    more check:

    http://msdn.microsoft.com/en-us/library/xx130603.aspx

    Hi Pdasg Ydyhnga,

    I've implemented localization & its working fine, but the problem is since I've done that I am receiving above mentioned error at random stage which cause the build to be failed. I then close VS & reopen it & it builds without any error. 



    Divyang Vyas

    Friday, November 28, 2014 8:07 AM
  • I am experiencing the exact same problem here. As soon as I make a change to a screen or to a data source, I get this error. I close VS 2013 update 4, reopen it, build and success. After the next change I make, I get the same error and can only "fix it" by closing and reopening VS again.

    Can you guess how fast I code? Very slowly! It's a pain in the ***!

    Please can some one help us with this issue?
    Monday, December 1, 2014 3:33 PM
  • You guys can submit this to ms:

    http://connect.microsoft.com/

    • Proposed as answer by dns jinung Wednesday, December 3, 2014 1:27 AM
    • Unproposed as answer by divyang_dv Thursday, March 12, 2015 1:54 PM
    Tuesday, December 2, 2014 9:13 AM
  • Submitted to MS, here is the link:

    https://connect.microsoft.com/VisualStudio/feedback/details/1044754


    Divyang Vyas

    • Proposed as answer by dns jinung Wednesday, December 3, 2014 1:27 AM
    • Marked as answer by Angie Xu Friday, December 5, 2014 2:48 AM
    • Unmarked as answer by divyang_dv Tuesday, January 20, 2015 1:01 PM
    • Unproposed as answer by divyang_dv Thursday, March 12, 2015 1:54 PM
    Tuesday, December 2, 2014 1:13 PM
  • then,just wait for the feedback
    Wednesday, December 3, 2014 1:26 AM
  • Submitted to MS, here is the link:

    https://connect.microsoft.com/VisualStudio/feedback/details/1044754


    Divyang Vyas


    I am unmarking the answer as it's on "Connect" for more than a month now yet it is not answered and no feedback is provided from MS.

    Divyang Vyas

    Tuesday, January 20, 2015 1:07 PM
  • Hi Divyang,

    You could always 'send a Frown' from within Visual Studio (using the Feedback icon which is next to the Notifications flag).

    Over the last year we've at least had replies from Microsoft using this method as opposed to logging the issues on Connect (though sometimes the 'Frown' response is to log the issue on Connect).

    Tuesday, January 20, 2015 1:44 PM
  • Right...but in my case I got the response initially &  asked for a sample project which I provided & there is no reply since then.

    Divyang Vyas

    Wednesday, January 21, 2015 7:56 AM
  • I have the same problem having added a localized HTML client to an existing LS app.

    Development is next to impossible with this issue.

    6 weeks without a response! - finger removal time I think Microsoft.

    Wednesday, January 21, 2015 12:32 PM
  • Same problem here after localizing the HTML Client.. Any feedback on this??
    Thursday, March 12, 2015 11:25 AM
  • Same problem here after localizing the HTML Client.. Any feedback on this??
    It has been submitted to MS Connect since December 2014 and not answered yet.

    Divyang Vyas

    Thursday, March 12, 2015 1:56 PM
  • I have the same problem.

    When localization resources were deleted the problem disappeared. 

    But when I added Service.resx again I found compilation conflict, because one of project entities was "Service" in ServiceDesk app :)

    Nevertheless renaming Service entity did not help.

    Wednesday, April 29, 2015 11:26 AM
  • I've also tryed this:

     - I went to the project's extensions tab, and removed the "Cosmopolitan Shell and Theme" and "LightSwitch Extensions". I can't remember exactly why i did this, i think i went digging and searching on the exception and found something about the Cosmopolitan.

    The "Get connection Strings" error disappears though, and it seems i'm able to work kind of normally, except for a somewhat random error whenever i try to access the project's properties again:

    "Can't send , MBRO helper not available"

    This is obviously not a fix since with this i can't work with both the Silverlight and Html Clients.


    Wednesday, April 29, 2015 12:17 PM
  • I've also tryed this:

     - I went to the project's extensions tab, and removed the "Cosmopolitan Shell and Theme" and "LightSwitch Extensions". I can't remember exactly why i did this, i think i went digging and searching on the exception and found something about the Cosmopolitan.

    The "Get connection Strings" error disappears though, and it seems i'm able to work kind of normally, except for a somewhat random error whenever i try to access the project's properties again:

    "Can't send , MBRO helper not available"

    This is obviously not a fix since with this i can't work with both the Silverlight and Html Clients.


    How to delete Cosmopolitan? It is off in project extension property (clear checkbox). And what is MBRO helper?

    Thursday, April 30, 2015 5:07 AM
  • I only unchecked the boxes, did not delete anything. Both the Cosmomopolitan and the "LightSwitch Extensions".

    With that i can work kind of normally, except for that error...

    Thursday, April 30, 2015 9:36 AM
  • Can you guys confirm me if you are using only the HTML client without the Desktop/Silverlight Client? After adding the Desktop/Silverlight Client everything went back to normal here... weird.
    Tuesday, May 5, 2015 5:36 PM
  • Can you guys confirm me if you are using only the HTML client without the Desktop/Silverlight Client? After adding the Desktop/Silverlight Client everything went back to normal here... weird.

    My! I have added Desktop Client and the problem was dissolved :)

    "LightSwitch Extensions" remains checked.

    Thank you Nuno!


    Wednesday, May 6, 2015 10:27 AM
  • Same here, after adding the Desktop Client the error disappeared however removing it, throws the error again.

    Divyang Vyas

    Thursday, May 7, 2015 8:47 AM
  • I don't expect Microsoft to answer on the other thread....

    So did anyone ever find a solution to this problem, even if it means rebuilding the project with localization in place from the beginning?

    I haven't tried that but before I go through that laborious process I thought I'd ask...

    Tuesday, June 9, 2015 8:17 PM
  • The funniest thing is Microsoft has closed this issue on Connect as fixed without any comment.

    Divyang Vyas

    Wednesday, June 10, 2015 4:45 AM
  • This problem is sorted in VS 2015.

    Divyang Vyas

    • Marked as answer by divyang_dv Tuesday, August 11, 2015 1:27 PM
    Tuesday, August 11, 2015 1:27 PM
  • no it's not i have the same problem vs 2015 update 3

    Wednesday, November 9, 2016 11:48 AM