Public Properties in VB Module - Cross-Client Behavior

Can one client call a public property in the VB.NET module and see the value of this public property changed by another client accessing it at the same time?

Example:

Client 1 calls

Public Module DataModule
    Private theDateTime As DateTime = GetAdjustedDateTime() //initial TZ value

    Public Property GetSetDateTime() As DateTime
        Get
            Return theDateTime
        End Get
        Set(ByVal value As String)
            theDateTime = value
        End Set
    End Property
End Module

setting the Property first and then getting the value in everything WhateverMethod () ...

Partial Class admintours
    Inherits System.Web.UI.Page

    Private Sub WhateverMethod()
            GetSetDateTime = Now
            ...
            ...
            ... //code
            ...
            SomeFunction(GetSetDateTime) //value is 10/14/2010 00:23:56
            ...    
            ...
            //almost simultaneously Client 2 sets the value to Now.AddDays(-1) 
            ...
            SomeOtherFunc(GetSetDateTime) //value passed in: 10/13/2010 00:23:56
            ...
            ...
            ... //some more code
            ...
    End Sub
End Class

I run into random instances where it looks like another client can change (by setting) the value of GetSetDateTime DURING the first client running through WhateverMethod (). This is alarming for me, and I tried to find out if this is possible. Any confirmation or other that would be helpful, thanks!

+3
source share
2 answers

VB.Net AppDomain. , AppDomain . , , AppDomain

, , ( , ).

+1

, "" ( AppDomain).

, "", , , , ? , GetSetDateTime WhateverMethod.

, WhateverMethod " 1", " 2", GetSetDateTime, WhateverMethod. , SyncLock .

GetSetDateTime , WhateverMethod :

Private Sub WhateverMethod()
        Dim localNow = Now
        GetSetDateTime = localNow
        ...
        SomeFunction(localNow)
        ...    
        SomeOtherFunc(localNow)
        ...
End Sub

?

+1

Source: https://habr.com/ru/post/1769671/


All Articles