Skip to content

Commit 304b05d

Browse files
Investigate issue with WCF channel not being properly closed in some cases. Add code to issue Abort on channel if an exception occurs. Fix problem in version 3.0 (vb and c#), 3.5 (vb and c#), 3.6
bugid: 196
1 parent 4c92451 commit 304b05d

File tree

2 files changed

+43
-17
lines changed

2 files changed

+43
-17
lines changed

cslavb/Csla/DataPortal/Client/DataPortal.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ Public Module DataPortal
467467
End If
468468

469469
Dim method = Server.DataPortalMethodCache.GetMethodInfo( _
470-
MethodCaller.GetObjectType(criteria), "DataPortal_Delete", criteria)
470+
objectType, "DataPortal_Delete", criteria)
471471

472472
Dim proxy As DataPortalClient.IDataPortalProxy
473473
proxy = GetDataPortalProxy(method.RunLocal)

cslavb/Csla/DataPortal/Client/WcfProxy.vb

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,16 @@ Namespace DataPortalClient
8282

8383
Dim cf As ChannelFactory(Of IWcfPortal) = GetChannelFactory()
8484
Dim svr As IWcfPortal = GetProxy(cf)
85-
Dim response As WcfResponse = svr.Create(New CreateRequest(objectType, criteria, context))
86-
If cf IsNot Nothing Then
87-
cf.Close()
88-
End If
85+
Dim response As WcfResponse = Nothing
86+
Try
87+
response = svr.Create(New CreateRequest(objectType, criteria, context))
88+
If cf IsNot Nothing Then
89+
cf.Close()
90+
End If
91+
Catch ex As Exception
92+
cf.Abort()
93+
Throw
94+
End Try
8995

9096
Dim result As Object = response.Result
9197
If TypeOf result Is Exception Then
@@ -108,10 +114,16 @@ Namespace DataPortalClient
108114

109115
Dim cf As ChannelFactory(Of IWcfPortal) = GetChannelFactory()
110116
Dim svr As IWcfPortal = GetProxy(cf)
111-
Dim response As WcfResponse = svr.Fetch(New FetchRequest(objectType, criteria, context))
112-
If cf IsNot Nothing Then
113-
cf.Close()
114-
End If
117+
Dim response As WcfResponse = Nothing
118+
Try
119+
response = svr.Fetch(New FetchRequest(objectType, criteria, context))
120+
If cf IsNot Nothing Then
121+
cf.Close()
122+
End If
123+
Catch ex As Exception
124+
cf.Abort()
125+
Throw
126+
End Try
115127

116128
Dim result As Object = response.Result
117129
If TypeOf result Is Exception Then
@@ -133,10 +145,17 @@ Namespace DataPortalClient
133145

134146
Dim cf As ChannelFactory(Of IWcfPortal) = GetChannelFactory()
135147
Dim svr As IWcfPortal = GetProxy(cf)
136-
Dim response As WcfResponse = svr.Update(New UpdateRequest(obj, context))
137-
If cf IsNot Nothing Then
138-
cf.Close()
139-
End If
148+
Dim response As WcfResponse = Nothing
149+
Try
150+
response = svr.Update(New UpdateRequest(obj, context))
151+
If cf IsNot Nothing Then
152+
cf.Close()
153+
End If
154+
Catch ex As Exception
155+
cf.Abort()
156+
Throw
157+
End Try
158+
140159

141160
Dim result As Object = response.Result
142161
If TypeOf result Is Exception Then
@@ -159,10 +178,17 @@ Namespace DataPortalClient
159178

160179
Dim cf As ChannelFactory(Of IWcfPortal) = GetChannelFactory()
161180
Dim svr As IWcfPortal = GetProxy(cf)
162-
Dim response As WcfResponse = svr.Delete(New DeleteRequest(objectType, criteria, context))
163-
If cf IsNot Nothing Then
164-
cf.Close()
165-
End If
181+
Dim response As WcfResponse = Nothing
182+
Try
183+
response = svr.Delete(New DeleteRequest(objectType, criteria, context))
184+
If cf IsNot Nothing Then
185+
cf.Close()
186+
End If
187+
Catch ex As Exception
188+
cf.Abort()
189+
Throw
190+
End Try
191+
166192

167193
Dim result As Object = response.Result
168194
If TypeOf result Is Exception Then

0 commit comments

Comments
 (0)