473,657 Members | 2,556 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WCF: Why is the client's IDisposeable implementation private?

Why is the IDisposeable implementation of WCF clients private?

I'm glad that you can still Dispose() by casting or with using ( .. ) { .. }
because IDisposable is indeed implemented but what was the design reasoning
to make Dispose() private?

Jon
May 21 '07 #1
13 1531
* Jon Davis wrote, On 21-5-2007 23:59:
Why is the IDisposeable implementation of WCF clients private?

I'm glad that you can still Dispose() by casting or with using ( .. ) { .. }
because IDisposable is indeed implemented but what was the design reasoning
to make Dispose() private?

Jon

This is usually done when there is a Close, End or Finish function,
which will call Dispose for you.

Jesse
May 21 '07 #2

"Jesse Houwing" <je***********@ nospam-sogeti.nlwrote in message
news:u$******** ******@TK2MSFTN GP04.phx.gbl...
>* Jon Davis wrote, On 21-5-2007 23:59:
>Why is the IDisposeable implementation of WCF clients private?

I'm glad that you can still Dispose() by casting or with using ( .. ) {
.. } because IDisposable is indeed implemented but what was the design
reasoning to make Dispose() private?

This is usually done when there is a Close, End or Finish function, which
will call Dispose for you.
I had thought the reverse, that Dispose() would perform closures, as with
using 'using' with Stream objects.

Jon
May 21 '07 #3
* Jon Davis wrote, On 22-5-2007 0:51:
"Jesse Houwing" <je***********@ nospam-sogeti.nlwrote in message
news:u$******** ******@TK2MSFTN GP04.phx.gbl...
>* Jon Davis wrote, On 21-5-2007 23:59:
>>Why is the IDisposeable implementation of WCF clients private?

I'm glad that you can still Dispose() by casting or with using ( .. ) {
.. } because IDisposable is indeed implemented but what was the design
reasoning to make Dispose() private?
This is usually done when there is a Close, End or Finish function, which
will call Dispose for you.

I had thought the reverse, that Dispose() would perform closures, as with
using 'using' with Stream objects.
Both functions dispose. They're implemented exactly the same, but Close
or FInish is a more logical name to close the underlying
stream/connection/transaction etc.

See the Close function of the Stream Class (used reflector to get to that):

public virtual void Close()
{
this.Dispose(tr ue);
GC.SuppressFina lize(this);
}
Jesse Houwing
May 22 '07 #4
Please note that Dispose method is not private. IDisposable is implemented
explicitly. This requires you to call the method on the reference of the
exact interface type.

"Jon Davis" <jo*@REMOVE.ME. PLEASE.jondavis .netwrote in message
news:eU******** ******@TK2MSFTN GP03.phx.gbl...
Why is the IDisposeable implementation of WCF clients private?

I'm glad that you can still Dispose() by casting or with using ( .. ) {
.. } because IDisposable is indeed implemented but what was the design
reasoning to make Dispose() private?

Jon

May 22 '07 #5

"Jesse Houwing" <je***********@ nospam-sogeti.nlwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>* Jon Davis wrote, On 22-5-2007 0:51:
>I had thought the reverse, that Dispose() would perform closures, as with
using 'using' with Stream objects.

Both functions dispose. They're implemented exactly the same, but Close or
FInish is a more logical name to close the underlying
stream/connection/transaction etc.

See the Close function of the Stream Class (used reflector to get to
that):

public virtual void Close()
{
this.Dispose(tr ue);
GC.SuppressFina lize(this);
}
That may be true, but it isn't obvious, and I don't like the inconsistent
design. SqlConnection has a Close() method, too, but it does not dispose.
http://blog.devstone.com/aaron/archi...06/03/184.aspx This is useful
because you can reopen a closed object. Generally if I see Close() I expect
to be able to reopen it if I want to, but I'm finding that a WCF client is
completely useless once Close() is called--whatever unmanaged resources were
exposed won't be recreated for me, I have to create a whole new WCF client.
Which is annoying because I'm trying to work with an "abstractly configured"
WCF client interface.

Jon
May 23 '07 #6
I'm finding that a WCF client is completely useless once Close() is
called--whatever unmanaged resources were exposed won't be recreated for
me, I have to create a whole new WCF client. Which is annoying because I'm
trying to work with an "abstractly configured" WCF client interface.
Incidentally, what's the deal with Faulted state? I can't
((IDisposable)c lient).Dispose( ) because it's in a faulted state. I can't
Close() it because it's in a faulted state. And if I just let it drop out of
scope before I recreate a new client, everything hangs for three seconds!!!!

Jon
May 23 '07 #7
Seriously? It causes Dispose() to fail? Eek. Looking at reflector,
Dispose() simply calls Close(), so I would (as you state) expect them
to behave the same... but I do hate it when Dispose() throws... it
makes tidy cleanup a pain...

Marc
May 23 '07 #8

"Marc Gravell" <ma**********@g mail.comwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
Seriously? It causes Dispose() to fail? Eek. Looking at reflector,
Dispose() simply calls Close(), so I would (as you state) expect them to
behave the same... but I do hate it when Dispose() throws... it makes tidy
cleanup a pain...
Yeah, the server is throwing an exception, and passing back a fault. Seeing
that and then trying again on the client side, Close() and Dispose() both
raise exceptions, "because it is in a Faulted state". (And without
Close()ing it, it hangs for seconds when I create and call a new client.)

Finding this I went home last night red-faced mad and wondering if
Microsoft's WCF QA team consists of 12-year-old children. I know that can't
be the case, so I'd like to know the simple answer to this problem.

Jon
May 23 '07 #9
Finding this I went home last night red-faced mad and wondering if
Microsoft's WCF QA team consists of 12-year-old children. I know that
can't be the case, so I'd like to know the simple answer to this problem.
It seems calling Abort() instead of Close() when in Faulted state seems to
resolve the 3-second wait issue. Reflection says that Abort() raises the
OnClosing and OnClosed events. It seems the dependency objects are using
delegate hooks to this event (InputQueueChan nel<TDisposable >,
LayeredChannel< TInnerChannel>, PeerChannelList enerBase,
PeerDuplexChann elAcceptor, PeerInputChanne lAcceptor, PeerOutputChann el,
WrapperSecurity CommunicationOb ject) ... not sure if any of these are even in
use. I'm surprised that Reflection's Analyze feature supports finding uses
of this event.

Jon
May 23 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
6312
by: jtbjurstrom | last post by:
Bear with me because we are new to WCF and have been going through documentation and samples trying to absorb as much as possible in a short amount of time. Any suggestions would be much appreciated. We would of course rather start off on the right path instead of learning later that there's a much better and easier solution, but get stuck with our original implementation. We are working on designing a client server solution using WCF...
0
8267
by: =?Utf-8?B?QWRyaWFuIENvbGU=?= | last post by:
I have written a simple WCF service hosted in a Windows console application and a simple WCF client console application that connects successfully to that service and retrieves data. I then ported the console application to WinForms and also got that to work properly. My next move was to host the WCF service in a Windows service application. I believe I have that working correctly, but I can't for the life of me get a client to connect...
3
3276
by: =?Utf-8?B?R3JlZw==?= | last post by:
I have just created a WCF service that is using WShttpbasic and all is good when another .net 3.0 application consumes it. However, I have legacy apps that must use this service and are running on .net 2.0 and are housed on Windows 2000 servers. I have been unable to find ANY info on how to do this, or if it is even possible. I find it hard to believe that WCF would not be able to be consumed by 2.0 applications.
0
5937
by: =?Utf-8?B?UmljaGFyZCBDb2xsZXR0ZQ==?= | last post by:
My goal is to connect a WSE 3.0 client to a WCF asp.net hosted service, utilizing MTOM encoding and if at all possible, streamedRequest transfer mode. I am starting with a basic Hello World service. I am basing the configuration on these articles: http://devlicio.us/blogs/ziemowit_skowronski/archive/2007/07/18/interoperability-between-wcf-and-wse-3-0.aspx http://msdn2.microsoft.com/en-us/library/ms730049.aspx When calling the hello...
4
17264
by: Dave Burns | last post by:
Hello, I am trying to specify a logical default value for a in a WCF Web Service using basicHttpBinding. I realize that the language defaults are: int - 0 string - null bool - false
16
2402
by: =?Utf-8?B?U3RldmUgQmFya2Vy?= | last post by:
WCF Question Hi guys, I’m pretty new to WCF, and have a basic question about how it works. I’m trying to use WCF to write an “SOA-system”, and am having a few problems. The following analogy explains what I’m trying to do. I have a very simple class:
5
5461
by: =?Utf-8?B?TWFyaw==?= | last post by:
I'm researching what is the best way to create a generic WCF proxy wrapper that has the following requirements: 1. Remove the System.ServiceModel config section requirement for clients. We have our own configuration management that follows our application lifecycle (development/system test/production). Also, most of the proxies we build are for the middle-tier layer. 2. Create a wrapper to follow WCF Client best practices (proxy.close...
2
12867
by: =?Utf-8?B?RWRkaWU=?= | last post by:
Here is my scenario for a problem I can't solve. I am hosting a 3.5 WCF service in IIS on Windows Server 2003. The service works fine with the WCF test client in Visual Studio 2008 and from an ASP.Net client hosted on my development machine in VS2008. As soon as I deploy the ASP.net client to the "Same" IIS server, I get Access Denied messages. My goal is to use AD security groups so the authenticated user on the ASP.net page should be...
3
5044
by: cmrhema | last post by:
Hi, Kindly excuse if I am posting in the wrong place. I am using Visual Studio 2008, .net framework 3.5, asp.net , c# and sql server 2005. I am supposed to pass stored procedures from client to wcf service. The WCF service should execute the stored procedure and return the result.
0
8397
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7333
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6167
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2731
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 we have to send another system
2
1957
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1620
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.