Activation Error when trying to get instance of IsolatedStorageLogEntryRepository - Invalid stream parameter head

Topics: Logging Application Block, Silverlight Integration Pack
Jun 13, 2011 at 5:55 AM

Hi,

I had been able to write and read from the isolated storage for a few days, until today...

I'm getting an error when getting trying to get an instance of the silverlight IsolatedStorageRepository in order to retrieve entries.

My Code:

Dim repository As TraceListeners.IsolatedStorageLogEntryRepository = EnterpriseLibraryContainer.Current.GetInstance(Of TraceListeners.IsolatedStorageLogEntryRepository)("isolated")

As i mentioned before, this code used to work. I have not changed it... is it possible for the repository to get 'corrupt' or something like that?

Below is the stack trace...

Message: Microsoft.Practices.ServiceLocation.ActivationException: Activation error occured while trying to get instance of type IsolatedStorageLogEntryRepository, key "isolated" ---> Microsoft.Practices.Unity.ResolutionFailedException: Resolution of the dependency failed, type = "Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.IsolatedStorageLogEntryRepository", name = "isolated".
Exception occurred while: Calling constructor Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.IsolatedStorageLogEntryRepository(System.String storageName, System.Int32 maxSizeInKilobytes).
Exception is: ArgumentException - Invalid stream parameter head.
Parameter name: stream
-----------------------------------------------
At the time of the exception, the container was:

  Resolving Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.IsolatedStorageLogEntryRepository,isolated
  Calling constructor Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.IsolatedStorageLogEntryRepository(System.String storageName, System.Int32 maxSizeInKilobytes)
 ---> System.ArgumentException: Invalid stream parameter head.
Parameter name: stream
   at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.BoundedStreamStorage..ctor(Stream stream)
   at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.IsolatedStorageLogEntryRepository.OpenStorageStream(Int32 maxSizeInKilobytes)
   at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.IsolatedStorageLogEntryRepository..ctor(String storageName, Int32 maxSizeInKilobytes)
   at BuildUp_Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.IsolatedStorageLogEntryRepository(IBuilderContext )
   at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(IBuilderContext context)
   at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context)
   at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
   at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides)
   --- End of inner exception stack trace ---
   at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides)
   at Microsoft.Practices.Unity.UnityContainer.Resolve(Type t, String name, ResolverOverride[] resolverOverrides)
   at Microsoft.Practices.Unity.UnityServiceLocator.DoGetInstance(Type serviceType, String key)
   at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)

Jun 13, 2011 at 6:20 AM

Hi,

It might be possible that the repository got corrupted or modified. Can you manually check the actual repository file if it has been modified by checking the modified date?

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 13, 2011 at 7:03 AM
Hi, sorry, how do I do this? Can I delete the repository and force it to be recreated?

- guna

On Jun 13, 2011, at 14:20, "AvanadeSupport" <notifications@codeplex.com> wrote:

From: AvanadeSupport

Hi,

It might be possible that the repository got corrupted or modified. Can you manually check the actual repository file if it has been modified by checking the modified date?

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 13, 2011 at 8:39 AM

I'm not aware of any way on how to delete the repository within silverlight other than going to the physical path of the repository and manually delete it there. The repository path would be C:\Users\{username}\AppData\LocalLow\Microsoft\Silverlight\is

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 13, 2011 at 8:40 AM
Thanks heaps! Will try this out and update.

On Jun 13, 2011, at 16:39, "AvanadeSupport" <notifications@codeplex.com> wrote:

From: AvanadeSupport

I'm not aware of any way on how to delete the repository within silverlight other than going to the physical path of the repository and manually delete it there. The repository path would be C:\Users\{username}\AppData\LocalLow\Microsoft\Silverlight\is

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 14, 2011 at 2:37 AM

Hi Noel,

Yes, finding and deleting the file solved this problem. I'm curious as to what corrupted the file, as this corruptions renders the entire logging mechanism to fail. *scary*