Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Store metadata "CurrentBind" is not valid" in debug of ClickOnce application

When I try to access "Application.CommonAppDataPath" i get this error message:

System.Deployment: Store metadata "CurrentBind" is not valid

Stack Trace:

at System.Deployment.Application.ComponentStore.GetPropertyString(DefinitionAppId appId, String propName)

This is only in Debug. When running as an actual published clickonce application it works fine.

How can I get rid of this exception when debugging locally?

like image 807
Espo Avatar asked Dec 16 '09 13:12

Espo


3 Answers

I had a similar issue (like jpierson's comment) with the same exception '"CurrentBind" not valid' on ApplicationDeployment.IsNetworkDeployed. I had unchecked "Options|Debugging|General|Just My Code". After checking it back all worked fine.

NOTE: Some other discussion threads had suggested reinstalling VS2010. I did that but did not help. I don't know if reinstalling was also the fator.

like image 150
mkale Avatar answered Nov 19 '22 12:11

mkale


I intentionally set VS to break on CLR exceptions. You certainly can mask this exception by only debugging your code but, it is still a valid bug that I'd like an explanation for. MS should be the forerunner on writing solid code.

like image 29
Steve Avatar answered Nov 19 '22 13:11

Steve


ApplicationDeployment.IsNetworkDeployed (in the System.Deployment.Application namespace) is a boolean property that returns true if the application was launched with ClickOnce.

if (ApplicationDeployment.IsNetworkDeployed)
{
    //CommonAppPath code
}

What are you trying to do with CommonAppDataPath? Depending on what you're trying to accomplish, we could probably come up with something that will work no matter how the app is launched.

like image 1
codeConcussion Avatar answered Nov 19 '22 12:11

codeConcussion