<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Interop on Marko Apfel</title><link>http://blog.marko-apfel.de/topics/interop/</link><description>Recent content in Interop on Marko Apfel</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Fri, 25 Nov 2011 14:10:00 +0100</lastBuildDate><atom:link href="http://blog.marko-apfel.de/topics/interop/index.xml" rel="self" type="application/rss+xml"/><item><title>Interop effects by resolving and instantiating types with ArcObjects</title><link>http://blog.marko-apfel.de/posts/interop-effects-by-resolving-and-instantiating-types-with-arcobjects/</link><pubDate>Fri, 25 Nov 2011 14:10:00 +0100</pubDate><guid>http://blog.marko-apfel.de/posts/interop-effects-by-resolving-and-instantiating-types-with-arcobjects/</guid><description>&lt;h1 id="problem"&gt;Problem&lt;/h1&gt;
&lt;p&gt;this code does not work&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Type t = typeof(ESRI.ArcGIS.Framework.AppRefClass);
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;System.Object obj = Activator.CreateInstance(t);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;but yet this code&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Type t = Type.GetTypeFromCLSID(typeof(ESRI.ArcGIS.Framework.AppRefClass).GUID);
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;System.Object obj = Activator.CreateInstance(t);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h1 id="reason"&gt;Reason&lt;/h1&gt;
&lt;p&gt;In the first variant the runtime tries to cast to AppRefClass . This is not possible.&lt;/p&gt;</description></item><item><title>"Failure has occurred while loading a type."</title><link>http://blog.marko-apfel.de/posts/failure-has-occurred-while-loading-a-type/</link><pubDate>Fri, 28 Oct 2011 12:08:00 +0200</pubDate><guid>http://blog.marko-apfel.de/posts/failure-has-occurred-while-loading-a-type/</guid><description>&lt;h1 id="motivation"&gt;Motivation&lt;/h1&gt;
&lt;p&gt;During programming suddenly this error (“Failure has occurred while loading a type”) was thrown by accessing a artifact of a referenced library.&lt;/p&gt;
&lt;p&gt;In such cases I take the assembly fusion logger fuslogvw to search for problems of loading assemblies. Sometimes an old version from a not expected folder is binded. But all bindings were correct.&lt;/p&gt;</description></item><item><title>Casing of COM-Interop registered components</title><link>http://blog.marko-apfel.de/posts/casing-of-com-interop-registered-components/</link><pubDate>Tue, 08 Jun 2010 09:54:00 +0200</pubDate><guid>http://blog.marko-apfel.de/posts/casing-of-com-interop-registered-components/</guid><description>&lt;p&gt;During a refactoring i realized that renaming of components, which will be registered for COM-Interop, must be done carefully.&lt;/p&gt;
&lt;p&gt;In my case i changed the casing of XyzToolbar to XyzToolBar.&lt;/p&gt;
&lt;p&gt;At the developing machine everything works fine. But after installing the modified stuff at the production machine, the toolbar was not visible. Using regasm with the new assemblies helped.&lt;/p&gt;</description></item><item><title>Gefahren des “cleanup code refactoring” im Zusammenhang mit P/Invoke und übergebenen Strukturen</title><link>http://blog.marko-apfel.de/posts/gefahren-des-cleanup-code-refactoring-im-zusammenhang-mit-p-invoke-und-ubergebenen-strukturen/</link><pubDate>Wed, 28 Apr 2010 09:40:00 +0200</pubDate><guid>http://blog.marko-apfel.de/posts/gefahren-des-cleanup-code-refactoring-im-zusammenhang-mit-p-invoke-und-ubergebenen-strukturen/</guid><description>&lt;h2 id="problemkontext"&gt;Problemkontext&lt;/h2&gt;
&lt;p&gt;So schön auch das automatische “cleanup code refactoring” von ReSharper ist, im Zusammenhang mit Strukturdefinitionen, die als Übergabe-Parameter für unmanaged Code Aufrufe benötigt werden, lauert eine große Gefahr.&lt;/p&gt;
&lt;p&gt;Standardmäßig ist im Profil “Full Cleanup” die Option “Reorder type members” auf “Yes” gestellt.&lt;/p&gt;</description></item><item><title>Catching COM-Exceptions from ArcObjects</title><link>http://blog.marko-apfel.de/posts/catching-com-exceptions-from-arcobjects/</link><pubDate>Tue, 20 Oct 2009 14:36:00 +0200</pubDate><guid>http://blog.marko-apfel.de/posts/catching-com-exceptions-from-arcobjects/</guid><description>&lt;p&gt;to catch the COM-Exception in own applications thrown from the underlaying ArcObjects-Library could be done with:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;catch (COMException ComEx)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Console.WriteLine(string.Format(&amp;#34;MyCode errored: {0}, Error Code: {1}&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; ComEx.Message, ComEx.ErrorCode));
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;the special error constants could be found under:&lt;/p&gt;</description></item></channel></rss>