Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operation is not valid due to the current state of the object #142

Closed
vhakti opened this issue May 9, 2024 · 1 comment · Fixed by #143
Closed

Operation is not valid due to the current state of the object #142

vhakti opened this issue May 9, 2024 · 1 comment · Fixed by #143

Comments

@vhakti
Copy link

vhakti commented May 9, 2024

Consider the following c# code:

private IBarrel _barrel;
public FileMonkeyCacheService()
{

 Barrel.ApplicationId = "any id..";
 _barrel = Barrel.Current;

}

when the application is starting in debug mode, the following exception is thrown on using Barrel instance object:

System.InvalidOperationException
  HResult=0x80073D54
  Message=**Operation is not valid due to the current state of the object.**
  Source=WinRT.Runtime
  StackTrace:
   at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|39_0(Int32 hr)
   at WinRT.ExceptionHelpers.ThrowExceptionForHR(Int32 hr)
   at ABI.Windows.Storage.IApplicationDataStaticsMethods.get_Current(IObjectReference _obj)
   at Windows.Storage.ApplicationData.get_Current()
   at MonkeyCache.BarrelUtils.GetBasePath(String applicationId)
   at MonkeyCache.FileStore.Barrel.<>c__DisplayClass4_0.<.ctor>b__0()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at MonkeyCache.FileStore.Barrel.LoadIndex()
   at MonkeyCache.FileStore.Barrel..ctor(String cacheDirectory, HashAlgorithm hash)
   at MonkeyCache.FileStore.Barrel.get_Current()
   at HelperDll.Contracts.FileMonkeyCacheService..ctor() in ...

Context: A test Maui blazor app was configured to be deployed as an unpackaged application. So it is not using MSIX.
the issue is happening only with this configuration. The default configuration with MSIX does not affect the application behaviour.

@vhakti
Copy link
Author

vhakti commented May 9, 2024

Duplicated with #141

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant