473,498 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Shared Properties disappearing

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
5 1566
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
3521
by: John Brock | last post by:
I have a base class with several derived classes (I'm writing in VB.NET). I want each derived class to have a unique class ID (a String), and I want the derived classes to inherit from the base...
2
3729
by: Paul Wu | last post by:
From what I understand, in ASP.NET, each HTTP requests is serviced by a separate thread. So if my code uses a static Class with shared members and properties, I can manage concurrent access by using...
2
1617
by: Don | last post by:
I'm asking this for a friend of mine, so forgive me if I'm getting some of the terminology wrong (I don't have any experience with ASP.NET). I've got an ASP application that has some classes that...
1
1741
by: Henri | last post by:
Hi, I'm using a custom class in my ASP.NET which has a Shared property. I don't want this Shared property to be shared between users because of thread concurrent accesses problems. I just want it...
11
3334
by: tshad | last post by:
I am setting up some of my functions in a class called MyFunctions. I am not clear as to the best time to set a function as Shared and when not to. For example, I have the following bit...
4
3330
by: Rubbrecht Philippe | last post by:
Hi there, I would like to develop an interface that when implemented in a class requires a number of shared properties or methods to be available. It seems a Shared Member can not be used as...
2
1453
by: mgoold2002 | last post by:
Hello. I've just begun programming in VB .NET, and I'm trying to turn all my modules into classes. In order to retrieve/exchange values from one class to another, I initiated New instances of the...
8
1999
by: Al | last post by:
I'd like to create Class Library in VB 2005, which has a property accessible by external programs. I decided to include 1 Class with 1 property in this project. I placed this code in Class:...
6
1488
by: wingphil | last post by:
Hi there, I have a shared method in a base class, and I need to know which subclass it has been called from. So for example Public Mustinherit Class BaseClass Public Shared Sub SharedMethod...
0
7005
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7168
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6891
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7381
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5465
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4916
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3087
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1424
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
293
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.