Select to view content in your preferred language

Load DLL referencing other native DLL (RuntimeCoreNet100_11_2.dll)

1869
5
07-19-2021 04:49 AM
SOTIRIOSTRIANTOS
Regular Contributor

When i am trying to consume a dll that uses an mmpk in order to use its locator, i get the following error "The type initializer for 'RuntimeCoreNet.GeneratedWrappers.CoreMobileMapPackage' threw an exception."  the inner exception message shows "Invalid ArcGISRuntime deployment folder, missing folder arcgisruntime100.11\client32"

The problem is that i am forced to use a windows form to call the locator's  dll, otherwise the locator's dll works fine (i.e a wpf application)

Any ideas? i tried using ilmerge with no succes since i cannot find any documentation.

0 Kudos
5 Replies
MichaelBranscomb
Esri Frequent Contributor

Can you provide more detail about your project/application type or even attach a small repro project?

Deployment info for .NET Framework and .NET Core/.NET is available here, but if you find it's insufficient we'd love to enhance it.

0 Kudos
SOTIRIOSTRIANTOS
Regular Contributor

Hi there and thank you very much for you prompt reply. To put it simply  i am trying to call the below dll (wpf library class)

 

    public class MapViewModel : INotifyPropertyChanged
    {
        //Static Fields
        public static LocatorTask _geocoder;

        public event PropertyChangedEventHandler PropertyChanged;
        /// <summary>
        /// Raises the <see cref="MapViewModel.PropertyChanged" /> event
        /// </summary>
        /// <param name="propertyName">The name of the property that has changed</param>
        protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            var propertyChangedHandler = PropertyChanged;
            if (propertyChangedHandler != null)
                propertyChangedHandler(this, new PropertyChangedEventArgs(propertyName));
        }

        public static async Task ConfigureStreetMapPremium()
        {
            // Get the path to the map package
            string streetMapPremiumPath = @"C:\Users\*********\source\repos\*****\****\bin\Debug\myMap.mmpk";
            //string streetMapPremiumPath = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "myMap.mmpk");
            //string streetMapPremiumPath = AppDomain.CurrentDomain.BaseDirectory + "myMap.mmpk";
            try
            {
                // Load the package
                MobileMapPackage streetMapPremiumPackage = await MobileMapPackage.OpenAsync(streetMapPremiumPath);

                // Geocoder from streetMapPremiumPackage
                _geocoder = streetMapPremiumPackage.LocatorTask;
                _geocoder.LoadAsync();
            }

            catch (Exception ex)
            {
                // Handle any exception
                System.Windows.MessageBox.Show(ex.Message, "Error opening package");
                return;
            }
        }
    }

 

 

 using a button like below (windows forms)

namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private async void button1_Click(object sender, EventArgs e)
        {
            await Locator.MapViewModel.ConfigureStreetMapPremium();
        }
    }
}

 

 

 

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Can you also share the contents of the csproj file? 

0 Kudos
SOTIRIOSTRIANTOS
Regular Contributor
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{399832F2-7852-4DC0-B948-4AB750F7E074}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Locator</RootNamespace>
    <AssemblyName>Locator</AssemblyName>
    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <Deterministic>true</Deterministic>
    <NuGetPackageImportStamp>
    </NuGetPackageImportStamp>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="PresentationCore" />
    <Reference Include="PresentationFramework" />
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Device" />
    <Reference Include="System.Net.Http.WebRequest" />
    <Reference Include="System.Xaml" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Xml" />
    <Reference Include="WindowsBase" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="MapViewModel.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Esri.ArcGISRuntime">
      <Version>100.11.2</Version>
    </PackageReference>
    <PackageReference Include="Esri.ArcGISRuntime.runtimes.win">
      <Version>100.11.2</Version>
    </PackageReference>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
0 Kudos
MichaelBranscomb
Esri Frequent Contributor

A couple of options for resolving this:

0 Kudos