<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>morty@home - Enterprise Services</title>
    <link>http://blog.morty.info/</link>
    <description>The Future is a Mix of Violet and Blue</description>
    <language>en-us</language>
    <copyright>morty</copyright>
    <lastBuildDate>Thu, 04 Dec 2003 22:10:57 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.2.8279.16125</generator>
    <managingEditor>spam@morty.info</managingEditor>
    <webMaster>spam@morty.info</webMaster>
    <item>
      <trackback:ping>http://blog.morty.info/Trackback.aspx?guid=97a86677-d33d-41b1-84a3-b3cf31f74307</trackback:ping>
      <pingback:server>http://blog.morty.info/pingback.aspx</pingback:server>
      <pingback:target>http://blog.morty.info/PermaLink.aspx?guid=97a86677-d33d-41b1-84a3-b3cf31f74307</pingback:target>
      <dc:creator />
      <wfw:comment>http://blog.morty.info/CommentView.aspx?guid=97a86677-d33d-41b1-84a3-b3cf31f74307</wfw:comment>
      <wfw:commentRss>http://blog.morty.info/SyndicationService.asmx/GetEntryCommentsRss?guid=97a86677-d33d-41b1-84a3-b3cf31f74307</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p xmlns="http://www.w3.org/1999/xhtml">
We were hunting down a weird bug at work today, and came across this interesting problem
with Enterprise Services. If you send a non-empty decimal array into a ServicedComponent
you get a “The parameter is incorrect.” argument exception.
</p>
        <p xmlns="http://www.w3.org/1999/xhtml">
Just create a method that takes a single argument, the decimal array, in your server
activated ServicedComponent and give it a trial run. You’ll need to use an interface
to get the COM magic going though.
</p>
        <pre xmlns="http://www.w3.org/1999/xhtml">
          <code> [assembly: ApplicationActivation(ActivationOption.Server)]
public interface ITest { void Test(decimal[] test); } public class TestComponent :
ServicedComponent, ITest { public void Test(decimal[] test) {} } class Client { static
void Main() { TestComponent cl = new TestComponent(); cl.Test(new decimal[] {1m, 2m});
} } </code>
        </pre>
        <p xmlns="http://www.w3.org/1999/xhtml">
Have fun ;)
</p>
      </body>
      <title>Incorrect Parameters and Enterprise Services</title>
      <guid isPermaLink="false">http://blog.morty.info/PermaLink.aspx?guid=97a86677-d33d-41b1-84a3-b3cf31f74307</guid>
      <link>http://blog.morty.info/PermaLink.aspx?guid=97a86677-d33d-41b1-84a3-b3cf31f74307</link>
      <pubDate>Thu, 04 Dec 2003 22:10:57 GMT</pubDate>
      <description>&lt;p xmlns="http://www.w3.org/1999/xhtml"&gt;
We were hunting down a weird bug at work today, and came across this interesting problem
with Enterprise Services. If you send a non-empty decimal array into a ServicedComponent
you get a &amp;#8220;The parameter is incorrect.&amp;#8221; argument exception.
&lt;/p&gt;
&lt;p xmlns="http://www.w3.org/1999/xhtml"&gt;
Just create a method that takes a single argument, the decimal array, in your server
activated ServicedComponent and give it a trial run. You&amp;#8217;ll need to use an interface
to get the COM magic going though.
&lt;/p&gt;
&lt;pre xmlns="http://www.w3.org/1999/xhtml"&gt;					&lt;code&gt; [assembly: ApplicationActivation(ActivationOption.Server)]
public interface ITest { void Test(decimal[] test); } public class TestComponent :
ServicedComponent, ITest { public void Test(decimal[] test) {} } class Client { static
void Main() { TestComponent cl = new TestComponent(); cl.Test(new decimal[] {1m, 2m});
} } &lt;/code&gt; &lt;/pre&gt;
&lt;p xmlns="http://www.w3.org/1999/xhtml"&gt;
Have fun ;)
&lt;/p&gt;</description>
      <comments>http://blog.morty.info/CommentView.aspx?guid=97a86677-d33d-41b1-84a3-b3cf31f74307</comments>
      <category>Enterprise Services</category>
    </item>
    <item>
      <trackback:ping>http://blog.morty.info/Trackback.aspx?guid=700c4d5d-f3a3-49ff-919a-8d83265306aa</trackback:ping>
      <pingback:server>http://blog.morty.info/pingback.aspx</pingback:server>
      <pingback:target>http://blog.morty.info/PermaLink.aspx?guid=700c4d5d-f3a3-49ff-919a-8d83265306aa</pingback:target>
      <dc:creator />
      <wfw:comment>http://blog.morty.info/CommentView.aspx?guid=700c4d5d-f3a3-49ff-919a-8d83265306aa</wfw:comment>
      <wfw:commentRss>http://blog.morty.info/SyndicationService.asmx/GetEntryCommentsRss?guid=700c4d5d-f3a3-49ff-919a-8d83265306aa</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p xmlns="http://www.w3.org/1999/xhtml">
I keep getting questions about the use of custom exceptions with serviced components,
and why they sometimes lose their type “on the wire”. As I never really finished this
topic in my previous <a href="http://morty.info/blog/2003/2.aspx?section=77856c10-15be-47f1-b5fa-2552341c338c">blog</a><a href="http://morty.info/blog/2003/2.aspx?section=1e83fca2-3773-4d56-aab1-677a919fc9a7">entries</a>,
I thought it was about time I provided a small conclusion.
</p>
        <p xmlns="http://www.w3.org/1999/xhtml">
From my somewhat limited understanding of the subject there is an optimization taking
place in the underlying infrastructure. If your method signature only contains isomorphic
types like integers, strings and doubles it is more efficient to use COM Interop to
communicate with serviced components because then you don’t have to utilize the .Net
serialization engine. However if your method signature contains more complex types,
non-isomorphic types like datasets, the .Net serialization engine will be used together
with .Net remoting over a custom DCOM channel. In the latter case your custom exceptions
will work as expected. Unfortunately, in the first case you will be limited by COM
Interop that uses the COM infrastructure, HRESULT values and IErrorInfo, to support
exception handling. The result is that exceptions with a registered HRESULT value
like most system exceptions will be recreated and returned as expected while custom
exceptions most likely will reappear as a COMException type if you provide your own
HRESULT or as an ApplicationException type if your exception simply derives from that
base class.
</p>
        <p xmlns="http://www.w3.org/1999/xhtml">
As far as I know there is no known fix for this problem short of forcing a more complex
method signature, which isn’t exactly something I would recommend.
</p>
      </body>
      <title>Enterprise Services and Exceptions III</title>
      <guid isPermaLink="false">http://blog.morty.info/PermaLink.aspx?guid=700c4d5d-f3a3-49ff-919a-8d83265306aa</guid>
      <link>http://blog.morty.info/PermaLink.aspx?guid=700c4d5d-f3a3-49ff-919a-8d83265306aa</link>
      <pubDate>Sun, 14 Sep 2003 06:25:01 GMT</pubDate>
      <description>
				&lt;p xmlns="http://www.w3.org/1999/xhtml"&gt;
I keep getting questions about the use of custom exceptions with serviced components,
and why they sometimes lose their type “on the wire”. As I never really finished this
topic in my previous &lt;a href="http://morty.info/blog/2003/2.aspx?section=77856c10-15be-47f1-b5fa-2552341c338c"&gt;blog&lt;/a&gt; &lt;a href="http://morty.info/blog/2003/2.aspx?section=1e83fca2-3773-4d56-aab1-677a919fc9a7"&gt;entries&lt;/a&gt;,
I thought it was about time I provided a small conclusion.
&lt;/p&gt;
&lt;p xmlns="http://www.w3.org/1999/xhtml"&gt;
From my somewhat limited understanding of the subject there is an optimization taking
place in the underlying infrastructure. If your method signature only contains isomorphic
types like integers, strings and doubles it is more efficient to use COM Interop to
communicate with serviced components because then you don’t have to utilize the .Net
serialization engine. However if your method signature contains more complex types,
non-isomorphic types like datasets, the .Net serialization engine will be used together
with .Net remoting over a custom DCOM channel. In the latter case your custom exceptions
will work as expected. Unfortunately, in the first case you will be limited by COM
Interop that uses the COM infrastructure, HRESULT values and IErrorInfo, to support
exception handling. The result is that exceptions with a registered HRESULT value
like most system exceptions will be recreated and returned as expected while custom
exceptions most likely will reappear as a COMException type if you provide your own
HRESULT or as an ApplicationException type if your exception simply derives from that
base class.
&lt;/p&gt;
&lt;p xmlns="http://www.w3.org/1999/xhtml"&gt;
As far as I know there is no known fix for this problem short of forcing a more complex
method signature, which isn’t exactly something I would recommend.
&lt;/p&gt;
			</description>
      <comments>http://blog.morty.info/CommentView.aspx?guid=700c4d5d-f3a3-49ff-919a-8d83265306aa</comments>
      <category>Enterprise Services</category>
    </item>
    <item>
      <trackback:ping>http://blog.morty.info/Trackback.aspx?guid=1e83fca2-3773-4d56-aab1-677a919fc9a7</trackback:ping>
      <pingback:server>http://blog.morty.info/pingback.aspx</pingback:server>
      <pingback:target>http://blog.morty.info/PermaLink.aspx?guid=1e83fca2-3773-4d56-aab1-677a919fc9a7</pingback:target>
      <dc:creator />
      <wfw:comment>http://blog.morty.info/CommentView.aspx?guid=1e83fca2-3773-4d56-aab1-677a919fc9a7</wfw:comment>
      <wfw:commentRss>http://blog.morty.info/SyndicationService.asmx/GetEntryCommentsRss?guid=1e83fca2-3773-4d56-aab1-677a919fc9a7</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p xmlns="http://www.w3.org/1999/xhtml">
          <a href="http://www.winterdom.com/weblog/archives/000225.html">Tomas</a> agrees with
me that the exception irregularities found when using Enterprise Services are indeed
interesting, and asks for clues. I have yet to find any, but I would be very surprised
if it wasn’t related to the marshalling services.
</p>
        <p xmlns="http://www.w3.org/1999/xhtml">
After doing a series of tests I’ve found that all basic types (integer, string, decimal
…) that probably have some optimized marshalling code introduce the exception problem,
but as soon as you add a custom type to the method signature, either it is a value
or reference type, the expected behavior takes place.
</p>
        <p xmlns="http://www.w3.org/1999/xhtml">
If I find the time I’ll try to delve more thoroughly into the problem area. This situation
is really annoying and I have yet to see any documentation or discussion about the
problem. Makes you wonder…
</p>
      </body>
      <title>Enterprise Services and Exceptions II</title>
      <guid isPermaLink="false">http://blog.morty.info/PermaLink.aspx?guid=1e83fca2-3773-4d56-aab1-677a919fc9a7</guid>
      <link>http://blog.morty.info/PermaLink.aspx?guid=1e83fca2-3773-4d56-aab1-677a919fc9a7</link>
      <pubDate>Sat, 22 Feb 2003 20:37:32 GMT</pubDate>
      <description>&lt;p xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;a href="http://www.winterdom.com/weblog/archives/000225.html"&gt;Tomas&lt;/a&gt; agrees with
me that the exception irregularities found when using Enterprise Services are indeed
interesting, and asks for clues. I have yet to find any, but I would be very surprised
if it wasn’t related to the marshalling services.
&lt;/p&gt;
&lt;p xmlns="http://www.w3.org/1999/xhtml"&gt;
After doing a series of tests I’ve found that all basic types (integer, string, decimal
…) that probably have some optimized marshalling code introduce the exception problem,
but as soon as you add a custom type to the method signature, either it is a value
or reference type, the expected behavior takes place.
&lt;/p&gt;
&lt;p xmlns="http://www.w3.org/1999/xhtml"&gt;
If I find the time I’ll try to delve more thoroughly into the problem area. This situation
is really annoying and I have yet to see any documentation or discussion about the
problem. Makes you wonder…
&lt;/p&gt;</description>
      <comments>http://blog.morty.info/CommentView.aspx?guid=1e83fca2-3773-4d56-aab1-677a919fc9a7</comments>
      <category>Enterprise Services</category>
    </item>
    <item>
      <trackback:ping>http://blog.morty.info/Trackback.aspx?guid=77856c10-15be-47f1-b5fa-2552341c338c</trackback:ping>
      <pingback:server>http://blog.morty.info/pingback.aspx</pingback:server>
      <pingback:target>http://blog.morty.info/PermaLink.aspx?guid=77856c10-15be-47f1-b5fa-2552341c338c</pingback:target>
      <dc:creator />
      <wfw:comment>http://blog.morty.info/CommentView.aspx?guid=77856c10-15be-47f1-b5fa-2552341c338c</wfw:comment>
      <wfw:commentRss>http://blog.morty.info/SyndicationService.asmx/GetEntryCommentsRss?guid=77856c10-15be-47f1-b5fa-2552341c338c</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p xmlns="http://www.w3.org/1999/xhtml">
          <a href="http://radio.weblogs.com/0117493/">Andreas Eide</a> and I have been playing
around with serviced components and custom exceptions, and so far we have discovered
some interesting results.
</p>
        <p xmlns="http://www.w3.org/1999/xhtml">
I have a test-setup running Windows XP SP1 and the .Net Framework v1.0 SP2. I have
created a serviced component and configured it to run in a server activated application.
The component implements the test interface below and uses no configuration attributes.
I have a client application that invokes all of the interface methods and each of
the method implementations in the component simply throw the same custom ApplicationException
derived exception.
</p>
        <p xmlns="http://www.w3.org/1999/xhtml">
The interesting thing is that three of the methods return the application exception
while the last two return the custom exception to the client.
</p>
        <pre xmlns="http://www.w3.org/1999/xhtml">
          <code> public interface ITest { int Test1();
// ApplicationException object Test2(); // CustomException void Test3(); // ApplicationException
void Test4(object o); // CustomException Guid Test5(DateTime dt); // ApplicationException
} </code>
        </pre>
        <p xmlns="http://www.w3.org/1999/xhtml">
I guess what is left now is to figure out why this happens, and I guess there are
quite a few things to consider. Does it have anything to do with reference objects
vs. value objects being passed; does it have anything to do with the shared memory
buffer sometimes used by LRPC? What is obvious though is that there is a difference
in the way exceptions are marshaled across processes.
</p>
        <p xmlns="http://www.w3.org/1999/xhtml">
What is obvious though is that there is a difference in the way exceptions are marshaled
across processes. It seems that in some cases IErrorInfo and Marshal.ThrowExceptionForHR
does its magic and in other cases the entire exception object is marshaled transferred.
</p>
      </body>
      <title>Enterprise Services and Exceptions</title>
      <guid isPermaLink="false">http://blog.morty.info/PermaLink.aspx?guid=77856c10-15be-47f1-b5fa-2552341c338c</guid>
      <link>http://blog.morty.info/PermaLink.aspx?guid=77856c10-15be-47f1-b5fa-2552341c338c</link>
      <pubDate>Thu, 13 Feb 2003 19:07:27 GMT</pubDate>
      <description>&lt;p xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;a href="http://radio.weblogs.com/0117493/"&gt;Andreas Eide&lt;/a&gt; and I have been playing
around with serviced components and custom exceptions, and so far we have discovered
some interesting results.
&lt;/p&gt;
&lt;p xmlns="http://www.w3.org/1999/xhtml"&gt;
I have a test-setup running Windows XP SP1 and the .Net Framework v1.0 SP2. I have
created a serviced component and configured it to run in a server activated application.
The component implements the test interface below and uses no configuration attributes.
I have a client application that invokes all of the interface methods and each of
the method implementations in the component simply throw the same custom ApplicationException
derived exception.
&lt;/p&gt;
&lt;p xmlns="http://www.w3.org/1999/xhtml"&gt;
The interesting thing is that three of the methods return the application exception
while the last two return the custom exception to the client.
&lt;/p&gt;
&lt;pre xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;code&gt; public interface ITest { int Test1();
// ApplicationException object Test2(); // CustomException void Test3(); // ApplicationException
void Test4(object o); // CustomException Guid Test5(DateTime dt); // ApplicationException
} &lt;/code&gt;&lt;/pre&gt;
&lt;p xmlns="http://www.w3.org/1999/xhtml"&gt;
I guess what is left now is to figure out why this happens, and I guess there are
quite a few things to consider. Does it have anything to do with reference objects
vs. value objects being passed; does it have anything to do with the shared memory
buffer sometimes used by LRPC? What is obvious though is that there is a difference
in the way exceptions are marshaled across processes.
&lt;/p&gt;
&lt;p xmlns="http://www.w3.org/1999/xhtml"&gt;
What is obvious though is that there is a difference in the way exceptions are marshaled
across processes. It seems that in some cases IErrorInfo and Marshal.ThrowExceptionForHR
does its magic and in other cases the entire exception object is marshaled transferred.
&lt;/p&gt;</description>
      <comments>http://blog.morty.info/CommentView.aspx?guid=77856c10-15be-47f1-b5fa-2552341c338c</comments>
      <category>Enterprise Services</category>
    </item>
    <item>
      <trackback:ping>http://blog.morty.info/Trackback.aspx?guid=3c65a27d-ca40-48f0-90d0-b091ebdf32aa</trackback:ping>
      <pingback:server>http://blog.morty.info/pingback.aspx</pingback:server>
      <pingback:target>http://blog.morty.info/PermaLink.aspx?guid=3c65a27d-ca40-48f0-90d0-b091ebdf32aa</pingback:target>
      <dc:creator />
      <wfw:comment>http://blog.morty.info/CommentView.aspx?guid=3c65a27d-ca40-48f0-90d0-b091ebdf32aa</wfw:comment>
      <wfw:commentRss>http://blog.morty.info/SyndicationService.asmx/GetEntryCommentsRss?guid=3c65a27d-ca40-48f0-90d0-b091ebdf32aa</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p xmlns="http://www.w3.org/1999/xhtml">
Once again <a href="http://radio.weblogs.com/0108971/2003/02/05.html#a110">Clemens</a> has
been down in his secret underground lab working on some new and exiting enterprise
services enhancements. This time he has cooked up a way to write AOP style serviced
component extensions in the same brilliant manner we have grown accustomed to. From
the looks of it his framework is designed to provide AOP through interception techniques.
Giving developers the ability to write these kinds of extensions is indeed a huge
and very important improvement to the existing serviced component architecture.
</p>
        <p xmlns="http://www.w3.org/1999/xhtml">
The ability to effectively separate crosscutting concerns is extremely important in
modern software designs. Security, adaptability and runtime tuning, monitoring, validation
and physical tier independence are some of the areas where one might want to apply
these techniques.
</p>
        <p xmlns="http://www.w3.org/1999/xhtml">
This sort of functionality has been on my wish list for some time now, and I can’t
wait for the bits to come out.
</p>
      </body>
      <title>AOP and Enterprise Services</title>
      <guid isPermaLink="false">http://blog.morty.info/PermaLink.aspx?guid=3c65a27d-ca40-48f0-90d0-b091ebdf32aa</guid>
      <link>http://blog.morty.info/PermaLink.aspx?guid=3c65a27d-ca40-48f0-90d0-b091ebdf32aa</link>
      <pubDate>Wed, 05 Feb 2003 21:37:33 GMT</pubDate>
      <description>&lt;p xmlns="http://www.w3.org/1999/xhtml"&gt;
Once again &lt;a href="http://radio.weblogs.com/0108971/2003/02/05.html#a110"&gt;Clemens&lt;/a&gt; has
been down in his secret underground lab working on some new and exiting enterprise
services enhancements. This time he has cooked up a way to write AOP style serviced
component extensions in the same brilliant manner we have grown accustomed to. From
the looks of it his framework is designed to provide AOP through interception techniques.
Giving developers the ability to write these kinds of extensions is indeed a huge
and very important improvement to the existing serviced component architecture.
&lt;/p&gt;
&lt;p xmlns="http://www.w3.org/1999/xhtml"&gt;
The ability to effectively separate crosscutting concerns is extremely important in
modern software designs. Security, adaptability and runtime tuning, monitoring, validation
and physical tier independence are some of the areas where one might want to apply
these techniques.
&lt;/p&gt;
&lt;p xmlns="http://www.w3.org/1999/xhtml"&gt;
This sort of functionality has been on my wish list for some time now, and I can’t
wait for the bits to come out.
&lt;/p&gt;</description>
      <comments>http://blog.morty.info/CommentView.aspx?guid=3c65a27d-ca40-48f0-90d0-b091ebdf32aa</comments>
      <category>Enterprise Services</category>
    </item>
  </channel>
</rss>