By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,918 Members | 1,923 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,918 IT Pros & Developers. It's quick & easy.

Shared Properties disappearing

P: n/a
Hi all,

We have an ASP.NET 1.1 application running on IIS6 on Server 2003.

Most of the base objects we are using in this application are taken from a
windows application also written by us. We have used shared properties on
some of these objects to enable caching of frequently used objects, so save
fetching them from SQL every time. These shared properties vastly increase
performance of our windows app.

So in our web app, we have left the same caching technique, by using shared
properties we cache various objects, usually in collections.

These collections have been strongly typed by utilising seperate classes and
storing an internal collection, e.g. see below.

Public Class AttributeCollection

Implements IEnumerable

Protected intCollection As New Collection

Public Overridable Sub Add(ByVal Attr As Attribute)
intCollection.Add(Attr, Attr.Name)
End Sub

Public Sub Remove(ByVal Attr As Attribute)
intCollection.Remove(Attr.Name)
End Sub

Public Sub Remove(ByVal AttrName As String)
intCollection.Remove(AttrName)
End Sub

Public Function Count() As Integer
Return intCollection.Count
End Function

Default ReadOnly Property Item(ByVal AttrName As String) As Attribute
Get
Return CType(intCollection.Item(AttrName), Attribute)
End Get
End Property
Default ReadOnly Property Item(ByVal index As Integer) As Attribute
Get
Return CType(intCollection.Item(index), Attribute)
End Get
End Property

Public Function GetEnumerator() As System.Collections.IEnumerator
Implements System.Collections.IEnumerable.GetEnumerator
Return intCollection.GetEnumerator
End Function
End Class

The problem, is that at certain times, the cached collection returns
containing nothing in the internal collection.

So the shared Property is returning ok, and is pointing to one of the
collections as shown above, however, the intcollection in the above code
contains nothing. so the code falls over. We cannot explain why the internal
collection for these objects is being emptied?

Anyone any ideas?

Thanks in advance and regards,
Simon.

Feb 8 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi there,

This is because web application is being unloaded from appdomain and all
shared variables are lost. Try to not use static memebrs in ASP.NET
applications, use Application state + Application_Start/Application_End
events instead.

Please find detailed explanation of this problem here
http://www.devsource.com/article2/0,1895,1876120,00.asp
--
Milosz Skalecki
MCP, MCAD
"Simon" wrote:
Hi all,

We have an ASP.NET 1.1 application running on IIS6 on Server 2003.

Most of the base objects we are using in this application are taken from a
windows application also written by us. We have used shared properties on
some of these objects to enable caching of frequently used objects, so save
fetching them from SQL every time. These shared properties vastly increase
performance of our windows app.

So in our web app, we have left the same caching technique, by using shared
properties we cache various objects, usually in collections.

These collections have been strongly typed by utilising seperate classes and
storing an internal collection, e.g. see below.

Public Class AttributeCollection

Implements IEnumerable

Protected intCollection As New Collection

Public Overridable Sub Add(ByVal Attr As Attribute)
intCollection.Add(Attr, Attr.Name)
End Sub

Public Sub Remove(ByVal Attr As Attribute)
intCollection.Remove(Attr.Name)
End Sub

Public Sub Remove(ByVal AttrName As String)
intCollection.Remove(AttrName)
End Sub

Public Function Count() As Integer
Return intCollection.Count
End Function

Default ReadOnly Property Item(ByVal AttrName As String) As Attribute
Get
Return CType(intCollection.Item(AttrName), Attribute)
End Get
End Property
Default ReadOnly Property Item(ByVal index As Integer) As Attribute
Get
Return CType(intCollection.Item(index), Attribute)
End Get
End Property

Public Function GetEnumerator() As System.Collections.IEnumerator
Implements System.Collections.IEnumerable.GetEnumerator
Return intCollection.GetEnumerator
End Function
End Class

The problem, is that at certain times, the cached collection returns
containing nothing in the internal collection.

So the shared Property is returning ok, and is pointing to one of the
collections as shown above, however, the intcollection in the above code
contains nothing. so the code falls over. We cannot explain why the internal
collection for these objects is being emptied?

Anyone any ideas?

Thanks in advance and regards,
Simon.

Feb 8 '06 #2

P: n/a
Thanks for the reply Milosz,

I understand your reasoning, but if all shared variables are lost, how come
the reference to the shared collection is working, it is only when it tries
to access the intCollection inside the shared collection class that the
application falls over.

e.g. Taking the collection from below, and putting it in a shared property,
Which is how it is working in our app.

Public Class Attribute

Private Shared _attributes As AttributeCollection

Public Shared Sub RefreshCache()

' Code to build the collection in here....

End Sub

Public Shared ReadOnly Property Attributes() As AttributeCollection
Get
If _attributes Is Nothing Then
RefreshCache()
End If
Return _attributes
End Get

End Property

End Class

Public Class AttributeCollection

Implements IEnumerable

Protected intCollection As New Collection

Public Overridable Sub Add(ByVal Attr As Attribute)
intCollection.Add(Attr, Attr.Name)
End Sub

Public Sub Remove(ByVal Attr As Attribute)
intCollection.Remove(Attr.Name)
End Sub

Public Sub Remove(ByVal AttrName As String)
intCollection.Remove(AttrName)
End Sub

Public Function Count() As Integer
Return intCollection.Count
End Function

Default ReadOnly Property Item(ByVal AttrName As String) As Attribute
Get
Return CType(intCollection.Item(AttrName), Attribute)
End Get
End Property
Default ReadOnly Property Item(ByVal index As Integer) As Attribute
Get
Return CType(intCollection.Item(index), Attribute)
End Get
End Property

Public Function GetEnumerator() As System.Collections.IEnumerator
Implements System.Collections.IEnumerable.GetEnumerator
Return intCollection.GetEnumerator
End Function

Public Function Contains(ByVal attrName As String) As Boolean
For Each attr As Attribute In intCollection
If attr.Name.ToLower = attrName.ToLower Then
Return True
End If
Next
Return False
End Function

End Class
Any code that references Attribute.Attributes never returns a null
reference, it always appears to return the correct collection object. But
when you then use Attribute.Attributes.Contains("name") it falls over in the
contains code. Saying that intcollection is nothing.

Hope you understand more.
And thanks again for your reply.
Simon.
"Milosz Skalecki" <mi*****@REMOVEITwp.pl> wrote in message
news:EE**********************************@microsof t.com...
Hi there,

This is because web application is being unloaded from appdomain and all
shared variables are lost. Try to not use static memebrs in ASP.NET
applications, use Application state + Application_Start/Application_End
events instead.

Please find detailed explanation of this problem here
http://www.devsource.com/article2/0,1895,1876120,00.asp
--
Milosz Skalecki
MCP, MCAD
"Simon" wrote:
Hi all,

We have an ASP.NET 1.1 application running on IIS6 on Server 2003.

Most of the base objects we are using in this application are taken from
a
windows application also written by us. We have used shared properties on
some of these objects to enable caching of frequently used objects, so
save
fetching them from SQL every time. These shared properties vastly
increase
performance of our windows app.

So in our web app, we have left the same caching technique, by using
shared
properties we cache various objects, usually in collections.

These collections have been strongly typed by utilising seperate classes
and
storing an internal collection, e.g. see below.

Public Class AttributeCollection

Implements IEnumerable

Protected intCollection As New Collection

Public Overridable Sub Add(ByVal Attr As Attribute)
intCollection.Add(Attr, Attr.Name)
End Sub

Public Sub Remove(ByVal Attr As Attribute)
intCollection.Remove(Attr.Name)
End Sub

Public Sub Remove(ByVal AttrName As String)
intCollection.Remove(AttrName)
End Sub

Public Function Count() As Integer
Return intCollection.Count
End Function

Default ReadOnly Property Item(ByVal AttrName As String) As Attribute
Get
Return CType(intCollection.Item(AttrName), Attribute)
End Get
End Property
Default ReadOnly Property Item(ByVal index As Integer) As Attribute
Get
Return CType(intCollection.Item(index), Attribute)
End Get
End Property

Public Function GetEnumerator() As System.Collections.IEnumerator
Implements System.Collections.IEnumerable.GetEnumerator
Return intCollection.GetEnumerator
End Function
End Class

The problem, is that at certain times, the cached collection returns
containing nothing in the internal collection.

So the shared Property is returning ok, and is pointing to one of the
collections as shown above, however, the intcollection in the above code
contains nothing. so the code falls over. We cannot explain why the
internal
collection for these objects is being emptied?

Anyone any ideas?

Thanks in advance and regards,
Simon.

Feb 8 '06 #3

P: n/a
Hi again,

First of all, your code is not thread safe. If you're going to use
static/shared members in multithreading environment (as in ASP.NET) you MUST
make it thread safe (synchronization, locks, etc). Use thread safe singleton
class or what’s quicker, save the time by simply using Application State or
Cache classes that are designed for storing/caching frequently used data in
such environment.

Hope this helps
--
Milosz Skalecki
MCP, MCAD
"Simon" wrote:
Thanks for the reply Milosz,

I understand your reasoning, but if all shared variables are lost, how come
the reference to the shared collection is working, it is only when it tries
to access the intCollection inside the shared collection class that the
application falls over.

e.g. Taking the collection from below, and putting it in a shared property,
Which is how it is working in our app.

Public Class Attribute

Private Shared _attributes As AttributeCollection

Public Shared Sub RefreshCache()

' Code to build the collection in here....

End Sub

Public Shared ReadOnly Property Attributes() As AttributeCollection
Get
If _attributes Is Nothing Then
RefreshCache()
End If
Return _attributes
End Get

End Property

End Class

Public Class AttributeCollection

Implements IEnumerable

Protected intCollection As New Collection

Public Overridable Sub Add(ByVal Attr As Attribute)
intCollection.Add(Attr, Attr.Name)
End Sub

Public Sub Remove(ByVal Attr As Attribute)
intCollection.Remove(Attr.Name)
End Sub

Public Sub Remove(ByVal AttrName As String)
intCollection.Remove(AttrName)
End Sub

Public Function Count() As Integer
Return intCollection.Count
End Function

Default ReadOnly Property Item(ByVal AttrName As String) As Attribute
Get
Return CType(intCollection.Item(AttrName), Attribute)
End Get
End Property
Default ReadOnly Property Item(ByVal index As Integer) As Attribute
Get
Return CType(intCollection.Item(index), Attribute)
End Get
End Property

Public Function GetEnumerator() As System.Collections.IEnumerator
Implements System.Collections.IEnumerable.GetEnumerator
Return intCollection.GetEnumerator
End Function

Public Function Contains(ByVal attrName As String) As Boolean
For Each attr As Attribute In intCollection
If attr.Name.ToLower = attrName.ToLower Then
Return True
End If
Next
Return False
End Function

End Class
Any code that references Attribute.Attributes never returns a null
reference, it always appears to return the correct collection object. But
when you then use Attribute.Attributes.Contains("name") it falls over in the
contains code. Saying that intcollection is nothing.

Hope you understand more.
And thanks again for your reply.
Simon.
"Milosz Skalecki" <mi*****@REMOVEITwp.pl> wrote in message
news:EE**********************************@microsof t.com...
Hi there,

This is because web application is being unloaded from appdomain and all
shared variables are lost. Try to not use static memebrs in ASP.NET
applications, use Application state + Application_Start/Application_End
events instead.

Please find detailed explanation of this problem here
http://www.devsource.com/article2/0,1895,1876120,00.asp
--
Milosz Skalecki
MCP, MCAD
"Simon" wrote:
Hi all,

We have an ASP.NET 1.1 application running on IIS6 on Server 2003.

Most of the base objects we are using in this application are taken from
a
windows application also written by us. We have used shared properties on
some of these objects to enable caching of frequently used objects, so
save
fetching them from SQL every time. These shared properties vastly
increase
performance of our windows app.

So in our web app, we have left the same caching technique, by using
shared
properties we cache various objects, usually in collections.

These collections have been strongly typed by utilising seperate classes
and
storing an internal collection, e.g. see below.

Public Class AttributeCollection

Implements IEnumerable

Protected intCollection As New Collection

Public Overridable Sub Add(ByVal Attr As Attribute)
intCollection.Add(Attr, Attr.Name)
End Sub

Public Sub Remove(ByVal Attr As Attribute)
intCollection.Remove(Attr.Name)
End Sub

Public Sub Remove(ByVal AttrName As String)
intCollection.Remove(AttrName)
End Sub

Public Function Count() As Integer
Return intCollection.Count
End Function

Default ReadOnly Property Item(ByVal AttrName As String) As Attribute
Get
Return CType(intCollection.Item(AttrName), Attribute)
End Get
End Property
Default ReadOnly Property Item(ByVal index As Integer) As Attribute
Get
Return CType(intCollection.Item(index), Attribute)
End Get
End Property

Public Function GetEnumerator() As System.Collections.IEnumerator
Implements System.Collections.IEnumerable.GetEnumerator
Return intCollection.GetEnumerator
End Function
End Class

The problem, is that at certain times, the cached collection returns
containing nothing in the internal collection.

So the shared Property is returning ok, and is pointing to one of the
collections as shown above, however, the intcollection in the above code
contains nothing. so the code falls over. We cannot explain why the
internal
collection for these objects is being emptied?

Anyone any ideas?

Thanks in advance and regards,
Simon.


Feb 8 '06 #4

P: n/a
Hi Milosz,

Thanks again for taking the time to reply.

So do you think that is the problem, that the classes are not thread safe,
and mutliple thread are possibly writing to the shared properties? and
somehow causing the internal intcollection to be nothing. It sounds
unlikely, but we're clutching at straws here, so are willing to try
anything.

So we wish to ensure that our objects are thread safe, however, these
objects are used in both a windows and an ASP.NET environment.
How is it best to go about making a class that is used in both asp.net and
windows thread safe for both environments?

Regards,
Simon.

"Milosz Skalecki" <mi*****@REMOVEITwp.pl> wrote in message
news:E8**********************************@microsof t.com...
Hi again,

First of all, your code is not thread safe. If you're going to use
static/shared members in multithreading environment (as in ASP.NET) you
MUST
make it thread safe (synchronization, locks, etc). Use thread safe
singleton
class or what's quicker, save the time by simply using Application State
or
Cache classes that are designed for storing/caching frequently used data
in
such environment.

Hope this helps
--
Milosz Skalecki
MCP, MCAD
"Simon" wrote:
Thanks for the reply Milosz,

I understand your reasoning, but if all shared variables are lost, how
come
the reference to the shared collection is working, it is only when it
tries
to access the intCollection inside the shared collection class that the
application falls over.

e.g. Taking the collection from below, and putting it in a shared
property,
Which is how it is working in our app.

Public Class Attribute

Private Shared _attributes As AttributeCollection

Public Shared Sub RefreshCache()

' Code to build the collection in here....

End Sub

Public Shared ReadOnly Property Attributes() As AttributeCollection
Get
If _attributes Is Nothing Then
RefreshCache()
End If
Return _attributes
End Get

End Property

End Class

Public Class AttributeCollection

Implements IEnumerable

Protected intCollection As New Collection

Public Overridable Sub Add(ByVal Attr As Attribute)
intCollection.Add(Attr, Attr.Name)
End Sub

Public Sub Remove(ByVal Attr As Attribute)
intCollection.Remove(Attr.Name)
End Sub

Public Sub Remove(ByVal AttrName As String)
intCollection.Remove(AttrName)
End Sub

Public Function Count() As Integer
Return intCollection.Count
End Function

Default ReadOnly Property Item(ByVal AttrName As String) As Attribute
Get
Return CType(intCollection.Item(AttrName), Attribute)
End Get
End Property
Default ReadOnly Property Item(ByVal index As Integer) As Attribute
Get
Return CType(intCollection.Item(index), Attribute)
End Get
End Property

Public Function GetEnumerator() As System.Collections.IEnumerator
Implements System.Collections.IEnumerable.GetEnumerator
Return intCollection.GetEnumerator
End Function

Public Function Contains(ByVal attrName As String) As Boolean
For Each attr As Attribute In intCollection
If attr.Name.ToLower = attrName.ToLower Then
Return True
End If
Next
Return False
End Function

End Class
Any code that references Attribute.Attributes never returns a null
reference, it always appears to return the correct collection object. But
when you then use Attribute.Attributes.Contains("name") it falls over in
the
contains code. Saying that intcollection is nothing.

Hope you understand more.
And thanks again for your reply.
Simon.
"Milosz Skalecki" <mi*****@REMOVEITwp.pl> wrote in message
news:EE**********************************@microsof t.com...
> Hi there,
>
> This is because web application is being unloaded from appdomain and
> all
> shared variables are lost. Try to not use static memebrs in ASP.NET
> applications, use Application state + Application_Start/Application_End
> events instead.
>
> Please find detailed explanation of this problem here
> http://www.devsource.com/article2/0,1895,1876120,00.asp
> --
> Milosz Skalecki
> MCP, MCAD
>
>
> "Simon" wrote:
>
>> Hi all,
>>
>> We have an ASP.NET 1.1 application running on IIS6 on Server 2003.
>>
>> Most of the base objects we are using in this application are taken
>> from
>> a
>> windows application also written by us. We have used shared properties
>> on
>> some of these objects to enable caching of frequently used objects, so
>> save
>> fetching them from SQL every time. These shared properties vastly
>> increase
>> performance of our windows app.
>>
>> So in our web app, we have left the same caching technique, by using
>> shared
>> properties we cache various objects, usually in collections.
>>
>> These collections have been strongly typed by utilising seperate
>> classes
>> and
>> storing an internal collection, e.g. see below.
>>
>> Public Class AttributeCollection
>>
>> Implements IEnumerable
>>
>> Protected intCollection As New Collection
>>
>> Public Overridable Sub Add(ByVal Attr As Attribute)
>> intCollection.Add(Attr, Attr.Name)
>> End Sub
>>
>> Public Sub Remove(ByVal Attr As Attribute)
>> intCollection.Remove(Attr.Name)
>> End Sub
>>
>> Public Sub Remove(ByVal AttrName As String)
>> intCollection.Remove(AttrName)
>> End Sub
>>
>> Public Function Count() As Integer
>> Return intCollection.Count
>> End Function
>>
>> Default ReadOnly Property Item(ByVal AttrName As String) As
>> Attribute
>> Get
>> Return CType(intCollection.Item(AttrName), Attribute)
>> End Get
>> End Property
>> Default ReadOnly Property Item(ByVal index As Integer) As
>> Attribute
>> Get
>> Return CType(intCollection.Item(index), Attribute)
>> End Get
>> End Property
>>
>> Public Function GetEnumerator() As System.Collections.IEnumerator
>> Implements System.Collections.IEnumerable.GetEnumerator
>> Return intCollection.GetEnumerator
>> End Function
>>
>>
>> End Class
>>
>> The problem, is that at certain times, the cached collection returns
>> containing nothing in the internal collection.
>>
>> So the shared Property is returning ok, and is pointing to one of the
>> collections as shown above, however, the intcollection in the above
>> code
>> contains nothing. so the code falls over. We cannot explain why the
>> internal
>> collection for these objects is being emptied?
>>
>> Anyone any ideas?
>>
>> Thanks in advance and regards,
>> Simon.
>>
>>
>>
>>


Feb 8 '06 #5

P: n/a
Howdy,

In this case I would use thread safe singleton:
http://www.yoda.arachsys.com/csharp/singleton.html
In this article you will find how to create static fields safely in
multithread environment.
Also read final part of the following article:
http://codebetter.com/blogs/steve.he...16/135697.aspx

Hope this helps
--
Milosz Skalecki
MCP, MCAD
"Simon" wrote:
Hi Milosz,

Thanks again for taking the time to reply.

So do you think that is the problem, that the classes are not thread safe,
and mutliple thread are possibly writing to the shared properties? and
somehow causing the internal intcollection to be nothing. It sounds
unlikely, but we're clutching at straws here, so are willing to try
anything.

So we wish to ensure that our objects are thread safe, however, these
objects are used in both a windows and an ASP.NET environment.
How is it best to go about making a class that is used in both asp.net and
windows thread safe for both environments?

Regards,
Simon.

"Milosz Skalecki" <mi*****@REMOVEITwp.pl> wrote in message
news:E8**********************************@microsof t.com...
Hi again,

First of all, your code is not thread safe. If you're going to use
static/shared members in multithreading environment (as in ASP.NET) you
MUST
make it thread safe (synchronization, locks, etc). Use thread safe
singleton
class or what's quicker, save the time by simply using Application State
or
Cache classes that are designed for storing/caching frequently used data
in
such environment.

Hope this helps
--
Milosz Skalecki
MCP, MCAD
"Simon" wrote:
Thanks for the reply Milosz,

I understand your reasoning, but if all shared variables are lost, how
come
the reference to the shared collection is working, it is only when it
tries
to access the intCollection inside the shared collection class that the
application falls over.

e.g. Taking the collection from below, and putting it in a shared
property,
Which is how it is working in our app.

Public Class Attribute

Private Shared _attributes As AttributeCollection

Public Shared Sub RefreshCache()

' Code to build the collection in here....

End Sub

Public Shared ReadOnly Property Attributes() As AttributeCollection
Get
If _attributes Is Nothing Then
RefreshCache()
End If
Return _attributes
End Get

End Property

End Class

Public Class AttributeCollection

Implements IEnumerable

Protected intCollection As New Collection

Public Overridable Sub Add(ByVal Attr As Attribute)
intCollection.Add(Attr, Attr.Name)
End Sub

Public Sub Remove(ByVal Attr As Attribute)
intCollection.Remove(Attr.Name)
End Sub

Public Sub Remove(ByVal AttrName As String)
intCollection.Remove(AttrName)
End Sub

Public Function Count() As Integer
Return intCollection.Count
End Function

Default ReadOnly Property Item(ByVal AttrName As String) As Attribute
Get
Return CType(intCollection.Item(AttrName), Attribute)
End Get
End Property
Default ReadOnly Property Item(ByVal index As Integer) As Attribute
Get
Return CType(intCollection.Item(index), Attribute)
End Get
End Property

Public Function GetEnumerator() As System.Collections.IEnumerator
Implements System.Collections.IEnumerable.GetEnumerator
Return intCollection.GetEnumerator
End Function

Public Function Contains(ByVal attrName As String) As Boolean
For Each attr As Attribute In intCollection
If attr.Name.ToLower = attrName.ToLower Then
Return True
End If
Next
Return False
End Function

End Class
Any code that references Attribute.Attributes never returns a null
reference, it always appears to return the correct collection object. But
when you then use Attribute.Attributes.Contains("name") it falls over in
the
contains code. Saying that intcollection is nothing.

Hope you understand more.
And thanks again for your reply.
Simon.
"Milosz Skalecki" <mi*****@REMOVEITwp.pl> wrote in message
news:EE**********************************@microsof t.com...
> Hi there,
>
> This is because web application is being unloaded from appdomain and
> all
> shared variables are lost. Try to not use static memebrs in ASP.NET
> applications, use Application state + Application_Start/Application_End
> events instead.
>
> Please find detailed explanation of this problem here
> http://www.devsource.com/article2/0,1895,1876120,00.asp
> --
> Milosz Skalecki
> MCP, MCAD
>
>
> "Simon" wrote:
>
>> Hi all,
>>
>> We have an ASP.NET 1.1 application running on IIS6 on Server 2003.
>>
>> Most of the base objects we are using in this application are taken
>> from
>> a
>> windows application also written by us. We have used shared properties
>> on
>> some of these objects to enable caching of frequently used objects, so
>> save
>> fetching them from SQL every time. These shared properties vastly
>> increase
>> performance of our windows app.
>>
>> So in our web app, we have left the same caching technique, by using
>> shared
>> properties we cache various objects, usually in collections.
>>
>> These collections have been strongly typed by utilising seperate
>> classes
>> and
>> storing an internal collection, e.g. see below.
>>
>> Public Class AttributeCollection
>>
>> Implements IEnumerable
>>
>> Protected intCollection As New Collection
>>
>> Public Overridable Sub Add(ByVal Attr As Attribute)
>> intCollection.Add(Attr, Attr.Name)
>> End Sub
>>
>> Public Sub Remove(ByVal Attr As Attribute)
>> intCollection.Remove(Attr.Name)
>> End Sub
>>
>> Public Sub Remove(ByVal AttrName As String)
>> intCollection.Remove(AttrName)
>> End Sub
>>
>> Public Function Count() As Integer
>> Return intCollection.Count
>> End Function
>>
>> Default ReadOnly Property Item(ByVal AttrName As String) As
>> Attribute
>> Get
>> Return CType(intCollection.Item(AttrName), Attribute)
>> End Get
>> End Property
>> Default ReadOnly Property Item(ByVal index As Integer) As
>> Attribute
>> Get
>> Return CType(intCollection.Item(index), Attribute)
>> End Get
>> End Property
>>
>> Public Function GetEnumerator() As System.Collections.IEnumerator
>> Implements System.Collections.IEnumerable.GetEnumerator
>> Return intCollection.GetEnumerator
>> End Function
>>
>>
>> End Class
>>
>> The problem, is that at certain times, the cached collection returns
>> containing nothing in the internal collection.
>>
>> So the shared Property is returning ok, and is pointing to one of the
>> collections as shown above, however, the intcollection in the above
>> code
>> contains nothing. so the code falls over. We cannot explain why the
>> internal
>> collection for these objects is being emptied?
>>
>> Anyone any ideas?
>>
>> Thanks in advance and regards,
>> Simon.
>>
>>
>>
>>


Feb 8 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.