Note that there are some explanatory texts on larger screens.

plurals
  1. PO.NET resolves a class to the wrong DLL
    primarykey
    data
    text
    <p>My C# project has references to two third party DLLs. This is important because it means I don't have access to source code and can't modify or recompile these two DLLs.</p> <p>Let's call them dll A and dll B. Here's what dll A looks like:</p> <pre><code>namespace ThirdParty.Foo { public class Bar { ...snip... } public class Something { public Bar MyProperty { get; set; } } } </code></pre> <p>And here's what dll B looks like:</p> <pre><code>namespace ThirdParty.Foo { public class Bar { ...snip... } public class SomethingElse { public Bar MyProperty { get; set; } } } </code></pre> <p>As you can see, they have the same namespace and they both define a class with the same name. My C# code needs a reference to both DLLs. I use the alias property on the reference to be able to distinguish between the two references and I also <code>extern alias firstDll</code> and <code>extern alias secondDll</code> at the top of my C# file. So far so good.</p> <p>It seems obvious to me that the type of <code>Something.MyProperty</code> is firstDll.ThirdParty.Foo.Bar and the type of <code>SomethingElse.MyProperty</code> is secondDll.ThirdParty.Foo.Bar but for some reason, Visual Studio gets confused and resolves the type of both properties to the same <code>Bar</code> class in firstDll. </p> <p>Is there a way for me to "force" VisualStudio to resolve the correct type?</p> <p>EDIT: the error I'm getting in Visual Studio is: Cannot implicitly convert type 'ThirdParty.Foo.Bar [d:\MySolution\References\Second.dll]' to 'ThirpParty.Foo.Bar [d:\MySolution\References\First.dll]'</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload