Reading IsolatedFileStorage repository for same xap but different page

Topics: Exception Handling Application Block, Logging Application Block, Silverlight Integration Pack
Jun 2, 2011 at 4:34 AM

Hi, I have this scenario:

1. I have a 'notification.xap' silverlight app that is on a page called notifications.aspx. This page will raise notifications to a user using the xap. This notifications page runs in a different frame and is 'hidden' from view to the user.

2. If there are error raising notifications, the xap will handle the exception using an enterprise library exception handler which is handled by the Logging handler, which writes to an IsolatedFileStorage called 'isolated'.

3. I also have a I have a public method, called GetExceptions() that reads the IsoFS using the EnterpriseLibraryContainer.Current.GetInstance(of IsolatedFileStorageRepository)("isolated").REtrieveEntries().

Implementation of 1 - 3 work fine. Any errors are logged correctly to IsoFS. Executing the GetExceptions method (on the same page) also works, i'm able to get a list of logentries and serialize them into a JSON string.

The problem

However, I need to read the exceptions and display them, on another page, called notificationerrors.aspx.

I tried putting a silverlight object on a notificationerrors.aspx page but reference the same xap used by the notifications.aspx. Meaning i have two pages, which use the same source xap for their silverlight application.

Now after notifications.aspx has logged an error, and i then load notificationerrors.aspx (in a different frame), and call the GetExceptions(), what happens is I get an error at the RetrieveEntries() method saying the "repository is in use by  another instance". EnterpriseLibraryContainer.Current.GetInstance(of IsolatedFileStorageRepository) returns the repository, but IsAvailable = 'false'. In my enterprise library settings, i have set 'AutoFlush' = True in the Logging block settings, so i thought the the repository will be released after log entry is written.

How can I retrieve logs written by the xap on one page, in another page? Does entlib lock the repository once initialized for the lifetime of the application's instance?

thanks.

Jun 2, 2011 at 12:05 PM

Hi,

We'll look into this and keep you posted for updates.

Gino Terrado
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 7, 2011 at 5:51 AM

Upon further investigation we have been able to reproduce the issue and we agree that this seems to look like a bug though not sure what is the Entlib team thoughts on this one. 

Though, I'm also thinking if this can be easily workaround by implementing caching the repository object to eliminate the lock issue. HTH.

Gino Terrado
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 8, 2011 at 7:20 AM

Hi,

thanks for that response. Yes it would be interesting to know what entlib team thinks.

I have worked around it for now by making the silverlight object and its necessary methods scriptable and using javascript on the 'display errors' page to get the instance of the silverlight object from the hidden frame (if exists). if an instance of the silverlight object exists in the hidden frame, I invoke the GetExceptions on that instance and i'm able to get the log entries and display.

 

thanks.

Jun 10, 2011 at 6:47 PM

Ideally, each instance of the Silverlight plug-in running in the same domain should be able to access the Isolated Storage logging facility without collision.  Atomic access to all log entries across all instances in each domain might be difficult, but what if a concession could be made so that each instance gets its own log file and is only able to access entries logged in that instance?