<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: xUnit  Tests from VS Test Explorer fail to find runtime.dll's in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/xunit-tests-from-vs-test-explorer-fail-to-find/m-p/1104110#M10504</link>
    <description>&lt;P&gt;Thank you! Much appreciated. I'm able to reproduce the issue and will log a bug for this. I think I might know what the problem is. Hopefully we can address this for the next release.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dotMorten_esri_0-1633123513093.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/24394i5089AD4CE8593170/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dotMorten_esri_0-1633123513093.png" alt="dotMorten_esri_0-1633123513093.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Oct 2021 21:31:03 GMT</pubDate>
    <dc:creator>dotMorten_esri</dc:creator>
    <dc:date>2021-10-01T21:31:03Z</dc:date>
    <item>
      <title>xUnit  Tests from VS Test Explorer fail to find runtime.dll's</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/xunit-tests-from-vs-test-explorer-fail-to-find/m-p/1102163#M10477</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;when calling ArcGIS code from unit tests, I receive the following exception: "System.InvalidOperationException : Invalid ArcGISRuntime deployment folder, missing folder arcgisruntime100.9\client64".&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are the steps I took / things I already found out to narrow down the problem:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Tested with&amp;nbsp;arcgisruntime 100.9 and 100.12 on .NET Framework 4.8&lt;/LI&gt;&lt;LI&gt;Only happens when running the tests from the visual studio built-in test explorer (Resharper test explorer works fine)&lt;/LI&gt;&lt;LI&gt;Only happens with xUnit framework (nUnit works fine)&lt;/LI&gt;&lt;LI&gt;Only happens when the test project is built for x64 (which we need to do, haven't tried for x86, but AnyCPU works)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The deployment folder mentioned in the error message is the exact folder where runtimecore.dll etc. are copied to when platform is set to AnyCPU. I guess this is why the AnyCPU configuration works.&lt;/P&gt;&lt;P&gt;For x64, the .dlls are located directly in bin\x64\Debug, but the test runner seems to expect them to be in bin\x64\Debug\arcgisruntime100.9\client64.&lt;/P&gt;&lt;P&gt;I set the option "Processor Architecture for AnyCPU Projects" available in the VS test explorer settings to x64, but that did not help.&lt;/P&gt;&lt;P&gt;My guess is that the xUnit specific VS test runner is somehow still configured as AnyCPU, but I could not find any info on how to change that.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Steps to reproduce:&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Create a test project with the nuget packages Esri.ArcGISRuntime.WPF, xunit and xunit.runner.visualstudio.&lt;/LI&gt;&lt;LI&gt;Set solution platform to x64.&lt;/LI&gt;&lt;LI&gt;Run this test:&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;       [Fact]
        public void SomeTest()
        {
            ArcGISTiledLayer currentMapLayer = new ArcGISTiledLayer(new Uri("https://tiledbasemaps.arcgis.com/arcgis/rest/services/World_Imagery/MapServer")) { NoDataTileBehavior = NoDataTileBehavior.UpSample };
        }​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know that this might be more a xunit related issue, but I was hoping you could still investigate.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 15:48:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/xunit-tests-from-vs-test-explorer-fail-to-find/m-p/1102163#M10477</guid>
      <dc:creator>qsmgruber</dc:creator>
      <dc:date>2021-09-27T15:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: xUnit  Tests from VS Test Explorer fail to find runtime.dll's</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/xunit-tests-from-vs-test-explorer-fail-to-find/m-p/1102189#M10478</link>
      <description>&lt;P&gt;The issue is likely that the manage runtime can't find its native libraries if they aren't deployed in the same folder as your executable (which is likely the test runner and not your test library). You can try setting the InstallPath property on test startup to help it find it if you're using .NET Framework (If you one day move to&amp;nbsp;use .NET Core / .NET 5, there's a different way to hint the runtime where native libs are to be loaded from)&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 16:26:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/xunit-tests-from-vs-test-explorer-fail-to-find/m-p/1102189#M10478</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2021-09-27T16:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: xUnit  Tests from VS Test Explorer fail to find runtime.dll's</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/xunit-tests-from-vs-test-explorer-fail-to-find/m-p/1102453#M10481</link>
      <description>&lt;P&gt;Thanks for the quick reply.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Adding the InstallPath as follows did not change anything.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;[Fact]
public void SomeTest(){
    ArcGISRuntimeEnvironment.InstallPath = Environment.CurrentDirectory;
    // Environment.CurrentDirectory = ...\bin\x64\Debug
    ArcGISTiledLayer currentMapLayer = new ArcGISTiledLayer(new Uri("https://tiledbasemaps.arcgis.com/arcgis/rest/services/World_Imagery/MapServer")) { NoDataTileBehavior = NoDataTileBehavior.UpSample };
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;What would be the way to do it in .NET 5?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 07:42:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/xunit-tests-from-vs-test-explorer-fail-to-find/m-p/1102453#M10481</guid>
      <dc:creator>qsmgruber</dc:creator>
      <dc:date>2021-09-28T07:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: xUnit  Tests from VS Test Explorer fail to find runtime.dll's</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/xunit-tests-from-vs-test-explorer-fail-to-find/m-p/1102459#M10482</link>
      <description>&lt;P&gt;As a workaround, I mirrored the expected folder structure in the source folder and added the missing runtime dlls manually. So in the test project, I created a folder ...\arcgisruntime100.9\client64, added runtimecore.dll,&amp;nbsp;runtimecorenet.dll and&amp;nbsp;runtimecorenet.wpf.dll, and set the build action to Content -&amp;gt; Copy If Newer for those dlls.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 08:13:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/xunit-tests-from-vs-test-explorer-fail-to-find/m-p/1102459#M10482</guid>
      <dc:creator>qsmgruber</dc:creator>
      <dc:date>2021-09-28T08:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: xUnit  Tests from VS Test Explorer fail to find runtime.dll's</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/xunit-tests-from-vs-test-explorer-fail-to-find/m-p/1102638#M10486</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;ArcGISRuntimeEnvironment.InstallPath = Environment.CurrentDirectory;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The path should be to where the arcgisruntime100.x folder is, not current directory (we already search current).&lt;/P&gt;&lt;P&gt;With .NET Core 3.1 and .NET 5+ you'd instead use the DllImportResolvers to help hinting at where libraries are located. However this might not be necessary, as these targets uses a built-in way to get the runtimes deployed that .NET Framework doesn't have, so things "might just work". Example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;              System.Runtime.InteropServices.NativeLibrary.SetDllImportResolver(typeof(Esri.ArcGISRuntime.ArcGISRuntimeEnvironment).Assembly, new System.Runtime.InteropServices.DllImportResolver(DllImportResolver));
  
// ...

 private static IntPtr runtimeLibPtr = IntPtr.Zero;

private static IntPtr DllImportResolver(string libraryName, Assembly assembly, System.Runtime.InteropServices.DllImportSearchPath? searchPath)
        {
            if (libraryName == "RuntimeCoreNet.dll")
            {
                if (runtimeLibPtr == IntPtr.Zero)
                {
                    System.Runtime.InteropServices.NativeLibrary.TryLoad(@$"installpath\client{(Environment.Is64BitProcess ? "64" : "32")}\RuntimeCoreNet.dll", out runtimeLibPtr);
                }
                return runtimeLibPtr;
            }
            return IntPtr.Zero;
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 16:00:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/xunit-tests-from-vs-test-explorer-fail-to-find/m-p/1102638#M10486</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2021-09-28T16:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: xUnit  Tests from VS Test Explorer fail to find runtime.dll's</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/xunit-tests-from-vs-test-explorer-fail-to-find/m-p/1102642#M10487</link>
      <description>&lt;P&gt;Any chance you could share a small simple xunit sample project that uses the runtime and demonstrates the problem? I'd like to see if we can't make this a bit easier, or work with the xunit team if something here is missing.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 15:59:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/xunit-tests-from-vs-test-explorer-fail-to-find/m-p/1102642#M10487</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2021-09-28T15:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: xUnit  Tests from VS Test Explorer fail to find runtime.dll's</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/xunit-tests-from-vs-test-explorer-fail-to-find/m-p/1103387#M10492</link>
      <description>&lt;P&gt;When I call "Environment.CurrentDirectory", it returns the path to the build output directory, which is where the&amp;nbsp;&lt;SPAN&gt;arcgisruntime100.x folder is located. So e.g. ...\bin\x64\debug.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 08:05:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/xunit-tests-from-vs-test-explorer-fail-to-find/m-p/1103387#M10492</guid>
      <dc:creator>qsmgruber</dc:creator>
      <dc:date>2021-09-30T08:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: xUnit  Tests from VS Test Explorer fail to find runtime.dll's</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/xunit-tests-from-vs-test-explorer-fail-to-find/m-p/1103389#M10493</link>
      <description>&lt;P&gt;I created this sample project. It demonstrates how the xUnit test fails while the nUnit test does not with the same configuration. Note that the project configuration needs to be manually set from AnyCPU to x64 in visual studio.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 08:13:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/xunit-tests-from-vs-test-explorer-fail-to-find/m-p/1103389#M10493</guid>
      <dc:creator>qsmgruber</dc:creator>
      <dc:date>2021-09-30T08:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: xUnit  Tests from VS Test Explorer fail to find runtime.dll's</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/xunit-tests-from-vs-test-explorer-fail-to-find/m-p/1104110#M10504</link>
      <description>&lt;P&gt;Thank you! Much appreciated. I'm able to reproduce the issue and will log a bug for this. I think I might know what the problem is. Hopefully we can address this for the next release.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dotMorten_esri_0-1633123513093.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/24394i5089AD4CE8593170/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dotMorten_esri_0-1633123513093.png" alt="dotMorten_esri_0-1633123513093.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Oct 2021 21:31:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/xunit-tests-from-vs-test-explorer-fail-to-find/m-p/1104110#M10504</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2021-10-01T21:31:03Z</dc:date>
    </item>
  </channel>
</rss>

