开发者

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

开发者 https://www.devze.com 2022-12-14 16:37 出处:网络
When I try to access \"Application.CommonAppDataPath\" i get this error message: System.Deployment: Store metadata

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?


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.


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.


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.


I had exactly the same problem. Thanks to mkale for pointing me in the right direction.

I had installed the Reflector VS Addin a few days ago, and at some point it asked about changing the Just My Code option. I had completely forgotten about it, and have been messing around with this problem for the last two days!

At the same time I also had a problem with FileLoadException - which was reporting in the Fusion log that "WRN: Comparing the assembly name resulted in the mismatch: Revision Number". Initially I got around that problem by setting the assembly version to 1.1.0.0 instead of as 1.1.*.

However, once having set the Just My Code option, all these problems disappeared.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号