Skip to content

Commit

Permalink
Investigate issue with WCF channel not being properly closed in some …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
sergeyb@magenic.com committed Oct 8, 2008
1 parent 4c92451 commit 304b05d
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cslavb/Csla/DataPortal/Client/DataPortal.vb
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ Public Module DataPortal
End If

Dim method = Server.DataPortalMethodCache.GetMethodInfo( _
MethodCaller.GetObjectType(criteria), "DataPortal_Delete", criteria)
objectType, "DataPortal_Delete", criteria)

Dim proxy As DataPortalClient.IDataPortalProxy
proxy = GetDataPortalProxy(method.RunLocal)
Expand Down
58 changes: 42 additions & 16 deletions cslavb/Csla/DataPortal/Client/WcfProxy.vb
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,16 @@ Namespace DataPortalClient

Dim cf As ChannelFactory(Of IWcfPortal) = GetChannelFactory()
Dim svr As IWcfPortal = GetProxy(cf)
Dim response As WcfResponse = svr.Create(New CreateRequest(objectType, criteria, context))
If cf IsNot Nothing Then
cf.Close()
End If
Dim response As WcfResponse = Nothing
Try
response = svr.Create(New CreateRequest(objectType, criteria, context))
If cf IsNot Nothing Then
cf.Close()
End If
Catch ex As Exception
cf.Abort()
Throw
End Try

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

Dim cf As ChannelFactory(Of IWcfPortal) = GetChannelFactory()
Dim svr As IWcfPortal = GetProxy(cf)
Dim response As WcfResponse = svr.Fetch(New FetchRequest(objectType, criteria, context))
If cf IsNot Nothing Then
cf.Close()
End If
Dim response As WcfResponse = Nothing
Try
response = svr.Fetch(New FetchRequest(objectType, criteria, context))
If cf IsNot Nothing Then
cf.Close()
End If
Catch ex As Exception
cf.Abort()
Throw
End Try

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

Dim cf As ChannelFactory(Of IWcfPortal) = GetChannelFactory()
Dim svr As IWcfPortal = GetProxy(cf)
Dim response As WcfResponse = svr.Update(New UpdateRequest(obj, context))
If cf IsNot Nothing Then
cf.Close()
End If
Dim response As WcfResponse = Nothing
Try
response = svr.Update(New UpdateRequest(obj, context))
If cf IsNot Nothing Then
cf.Close()
End If
Catch ex As Exception
cf.Abort()
Throw
End Try


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

Dim cf As ChannelFactory(Of IWcfPortal) = GetChannelFactory()
Dim svr As IWcfPortal = GetProxy(cf)
Dim response As WcfResponse = svr.Delete(New DeleteRequest(objectType, criteria, context))
If cf IsNot Nothing Then
cf.Close()
End If
Dim response As WcfResponse = Nothing
Try
response = svr.Delete(New DeleteRequest(objectType, criteria, context))
If cf IsNot Nothing Then
cf.Close()
End If
Catch ex As Exception
cf.Abort()
Throw
End Try


Dim result As Object = response.Result
If TypeOf result Is Exception Then
Expand Down

0 comments on commit 304b05d

Please sign in to comment.