<?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:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" version="2.0">
  <channel>
    <title>ploeh blog - Sync</title>
    <link>http://blog.ploeh.dk/</link>
    <description>Mark Seemann's .NET blog</description>
    <language>en-us</language>
    <copyright>Mark Seemann</copyright>
    <lastBuildDate>Thu, 21 May 2009 18:54:01 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>mark@seemann.ms</managingEditor>
    <webMaster>mark@seemann.ms</webMaster>
    <item>
      <trackback:ping>http://blog.ploeh.dk/Trackback.aspx?guid=56eac1c1-e5f8-4a59-9e09-24bb1541c34a</trackback:ping>
      <pingback:server>http://blog.ploeh.dk/pingback.aspx</pingback:server>
      <pingback:target>http://blog.ploeh.dk/PermaLink,guid,56eac1c1-e5f8-4a59-9e09-24bb1541c34a.aspx</pingback:target>
      <dc:creator>Mark Seemann</dc:creator>
      <wfw:comment>http://blog.ploeh.dk/CommentView,guid,56eac1c1-e5f8-4a59-9e09-24bb1541c34a.aspx</wfw:comment>
      <wfw:commentRss>http://blog.ploeh.dk/SyndicationService.asmx/GetEntryCommentsRss?guid=56eac1c1-e5f8-4a59-9e09-24bb1541c34a</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
This post describes a particular problem I ran into when working with the Microsoft
Sync Framework. Since I found a solution, I’m sharing it here to help others. If you
are not having this particular problem, it’s quite safe to skip reading the rest of
the post :)
</p>
        <p>
While developing a SyncProvider, I wanted to create and execute a series of <a href="http://blogs.msdn.com/ploeh/archive/2006/08/27/727211.aspx">Integration
Tests</a> to drive my development effort. In order to do that, I wrote a simple test
that simply created a SyncOrchestrator instance and invoked its Synchronize method.
</p>
        <p>
Running this test gave me this error message:
</p>
        <p>
“Microsoft.Synchronization.SyncException: Retrieving the COM class factory for component
with CLSID {A7B3B4EE-925C-4D6C-B007-A4A6A0B09143} failed due to the following error:
80040154. ---&gt;  System.Runtime.InteropServices.COMException: Retrieving the
COM class factory for component with CLSID {A7B3B4EE-925C-4D6C-B007-A4A6A0B09143}
failed due to the following error: 80040154.”
</p>
        <p>
It’s not often I see a COMException these days, so I was initially baffled. Since
the Sync Framework also has an unmanaged API, this is really not surprising, but that
didn’t help me solve my problem.
</p>
        <p>
What was even weirder was that when I tried running the same code in my application,
this exception was <em>not</em> being thrown.
</p>
        <p>
It took me a couple of hours to figure out what the problem was.
</p>
        <p>
Here’s a little hint: I’m running Windows Vista x64.
</p>
        <p>
No: The issue is not that I’m running Vista :)
</p>
        <p>
Even on x64, Visual Studio runs as a 32-bit process, and so does MSTest. Since my
code was compiled to <em>Any CPU</em>, the application itself was running in a 64-bit
process, whereas my unit test was running in a 32-bit process.
</p>
        <p>
I tried changing my build output to x86, and now the application started throwing
the same exception as the unit test did.
</p>
        <p>
In other words: When running in a 64-bit process, everything worked as intended. When
running in a 32-bit process, a COMException was thrown.
</p>
        <p>
As it turned out, I had only installed the 64-bit version of the Sync Framework, and
even though the SDK seems to contain builds for the other architectures as well, the
COM Server wasn’t properly registered for 32-bit use.
</p>
        <p>
To resolve this issue, I downloaded and installed the x86 version of the Sync Framework
as well, and the problem went away.
</p>
        <p>
If you are having the same problem, I hope this post helps you resolve it.
</p>
        <img width="0" height="0" src="http://blog.ploeh.dk/aggbug.ashx?id=56eac1c1-e5f8-4a59-9e09-24bb1541c34a" />
      </body>
      <title>SyncOrchestrator.Synchronize() Throws COMException When Unit Testing</title>
      <guid isPermaLink="false">http://blog.ploeh.dk/PermaLink,guid,56eac1c1-e5f8-4a59-9e09-24bb1541c34a.aspx</guid>
      <link>http://blog.ploeh.dk/2009/05/21/SyncOrchestratorSynchronizeThrowsCOMExceptionWhenUnitTesting.aspx</link>
      <pubDate>Thu, 21 May 2009 18:54:01 GMT</pubDate>
      <description>&lt;p&gt;
This post describes a particular problem I ran into when working with the Microsoft
Sync Framework. Since I found a solution, I’m sharing it here to help others. If you
are not having this particular problem, it’s quite safe to skip reading the rest of
the post :)
&lt;/p&gt;
&lt;p&gt;
While developing a SyncProvider, I wanted to create and execute a series of &lt;a href="http://blogs.msdn.com/ploeh/archive/2006/08/27/727211.aspx"&gt;Integration
Tests&lt;/a&gt; to drive my development effort. In order to do that, I wrote a simple test
that simply created a SyncOrchestrator instance and invoked its Synchronize method.
&lt;/p&gt;
&lt;p&gt;
Running this test gave me this error message:
&lt;/p&gt;
&lt;p&gt;
“Microsoft.Synchronization.SyncException: Retrieving the COM class factory for component
with CLSID {A7B3B4EE-925C-4D6C-B007-A4A6A0B09143} failed due to the following error:
80040154. ---&amp;gt;&amp;nbsp; System.Runtime.InteropServices.COMException: Retrieving the
COM class factory for component with CLSID {A7B3B4EE-925C-4D6C-B007-A4A6A0B09143}
failed due to the following error: 80040154.”
&lt;/p&gt;
&lt;p&gt;
It’s not often I see a COMException these days, so I was initially baffled. Since
the Sync Framework also has an unmanaged API, this is really not surprising, but that
didn’t help me solve my problem.
&lt;/p&gt;
&lt;p&gt;
What was even weirder was that when I tried running the same code in my application,
this exception was &lt;em&gt;not&lt;/em&gt; being thrown.
&lt;/p&gt;
&lt;p&gt;
It took me a couple of hours to figure out what the problem was.
&lt;/p&gt;
&lt;p&gt;
Here’s a little hint: I’m running Windows Vista x64.
&lt;/p&gt;
&lt;p&gt;
No: The issue is not that I’m running Vista :)
&lt;/p&gt;
&lt;p&gt;
Even on x64, Visual Studio runs as a 32-bit process, and so does MSTest. Since my
code was compiled to &lt;em&gt;Any CPU&lt;/em&gt;, the application itself was running in a 64-bit
process, whereas my unit test was running in a 32-bit process.
&lt;/p&gt;
&lt;p&gt;
I tried changing my build output to x86, and now the application started throwing
the same exception as the unit test did.
&lt;/p&gt;
&lt;p&gt;
In other words: When running in a 64-bit process, everything worked as intended. When
running in a 32-bit process, a COMException was thrown.
&lt;/p&gt;
&lt;p&gt;
As it turned out, I had only installed the 64-bit version of the Sync Framework, and
even though the SDK seems to contain builds for the other architectures as well, the
COM Server wasn’t properly registered for 32-bit use.
&lt;/p&gt;
&lt;p&gt;
To resolve this issue, I downloaded and installed the x86 version of the Sync Framework
as well, and the problem went away.
&lt;/p&gt;
&lt;p&gt;
If you are having the same problem, I hope this post helps you resolve it.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.ploeh.dk/aggbug.ashx?id=56eac1c1-e5f8-4a59-9e09-24bb1541c34a" /&gt;</description>
      <comments>http://blog.ploeh.dk/CommentView,guid,56eac1c1-e5f8-4a59-9e09-24bb1541c34a.aspx</comments>
      <category>Sync</category>
    </item>
  </channel>
</rss>