Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't load RuntimeCoreNet.dll #131

Closed
SteveMcKean opened this issue Mar 25, 2020 · 9 comments
Closed

Can't load RuntimeCoreNet.dll #131

SteveMcKean opened this issue Mar 25, 2020 · 9 comments

Comments

@SteveMcKean
Copy link

Working with .net core 3.1 and wpf/esri mapping solution. Running in vs no issues but after installing application we get the following error:

Application: Volcano.MappingHost.exe CoreCLR Version: 4.700.19.60701 .NET Core Version: 3.1.1 Description: The process was terminated due to an unhandled exception. Exception Info: Prism.Modularity.ModuleInitializeException: An exception occurred while initializing module 'MappingModule'. - The exception message was: An exception has occurred while trying to add a view to region 'MapContentRegion'. - The most likely causing exception was was: 'System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Windows.Markup.XamlParseException: Set property 'Prism.Mvvm.ViewModelLocator.AutoWireViewModel' threw an exception. ---> System.TypeInitializationException: The type initializer for 'RuntimeCoreNet.GeneratedWrappers.CoreWrapperBase' threw an exception. ---> System.InvalidOperationException: Could not load ArcGIS Runtime (RuntimeCoreNet.dll) or one of its dependencies. Ensure "Microsoft Visual C++ 2015-2019 Redistributable" is installed. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (0x8007000B) at RuntimeCoreNet.GeneratedWrappers.CoreArcGISRuntimeEnvironment.CoreRT_ArcGISRuntimeEnvironment_setInstallDirectory(Byte[] installPath, IntPtr& outErrorHandle) at RuntimeCoreNet.GeneratedWrappers.CoreArcGISRuntimeEnvironment.SetInstallDirectory(String installPath) at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.TryInitialize() --- End of inner exception stack trace --- at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.TryInitialize() at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.InitNative() at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.Initialize() at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.OnBeforeFirstUseOfGeneratedWrapper() at RuntimeCoreNet.GeneratedWrappers.CoreWrapperBase..cctor() --- End of inner exception stack trace --- at RuntimeCoreNet.GeneratedWrappers.CoreWrapperBase..ctor(IntPtr handle) at RuntimeCoreNet.GeneratedWrappers.CoreColor..ctor(IntPtr handle) at RuntimeCoreNet.GeneratedWrappers.CoreRGBColor..ctor(IntPtr handle) at RuntimeCoreNet.GeneratedWrappers.CoreRGBColor..ctor(Byte red, Byte green, Byte blue, Byte alpha) at Esri.ArcGISRuntime.Internal.GraphicUtils.FromColorToCore(Color color) at Esri.ArcGISRuntime.Symbology.SimpleFillSymbol..ctor(SimpleFillSymbolStyle style, Color color, LineSymbol outline) at Volcano.Module.Mapping.MapCore.MapViewController..ctor(IEventAggregator eventAggregator) in D:\Projects\VolcanoMapping\Volcano.Module.Mapping\MapCore\MapViewController.cs:line 21 --- End of inner exception stack trace --- at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri) at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri) at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri) at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream) at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator) at Volcano.Module.Mapping.Views.VolcanoMapView.InitializeComponent() at Volcano.Module.Mapping.Views.VolcanoMapView..ctor() in D:\Projects\VolcanoMapping\Volcano.Module.Mapping\Views\VolcanoMapView.xaml.cs:line 9 --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Unity.Processors.ConstructorProcessor.<>c__DisplayClass16_0.b__0(BuilderContext& c) at Unity.Processors.MemberProcessor2.<>c__DisplayClass8_0.<GetResolver>b__0(BuilderContext& c) at Unity.Processors.MemberProcessor2.<>c__DisplayClass8_0.b__0(BuilderContext& c) at Unity.Processors.MemberProcessor2.<>c__DisplayClass8_0.<GetResolver>b__0(BuilderContext& c) at Unity.UnityContainer.<>c__DisplayClass111_0.<OptimizingFactory>b__0(BuilderContext& c) at Unity.Strategies.BuildPlanStrategy.PreBuildUp(BuilderContext& context) at Unity.UnityContainer.<>c.<.ctor>b__73_1(BuilderContext& context) at Unity.UnityContainer.Unity.IUnityContainer.Resolve(Type type, String name, ResolverOverride[] overrides) at Prism.Unity.UnityServiceLocatorAdapter.DoGetInstance(Type serviceType, String key) at CommonServiceLocator.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)'. But also check the InnerExceptions for more detail or call .GetRootException(). - The Assembly that the module was trying to be loaded from was:Volcano.Module.Mapping, Version=1.0.22.0, Culture=neutral, PublicKeyToken=null Check the InnerException property of the exception for more information. If the exception occurred while creating an object in a DI container, you can exception.GetRootException() to help locate the root cause of the problem. ---> Prism.Regions.ViewRegistrationException: An exception has occurred while trying to add a view to region 'MapContentRegion'. - The most likely causing exception was was: 'System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Windows.Markup.XamlParseException: Set property 'Prism.Mvvm.ViewModelLocator.AutoWireViewModel' threw an exception. ---> System.TypeInitializationException: The type initializer for 'RuntimeCoreNet.GeneratedWrappers.CoreWrapperBase' threw an exception. ---> System.InvalidOperationException: Could not load ArcGIS Runtime (RuntimeCoreNet.dll) or one of its dependencies. Ensure "Microsoft Visual C++ 2015-2019 Redistributable" is installed. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (0x8007000B) at RuntimeCoreNet.GeneratedWrappers.CoreArcGISRuntimeEnvironment.CoreRT_ArcGISRuntimeEnvironment_setInstallDirectory(Byte[] installPath, IntPtr& outErrorHandle) at RuntimeCoreNet.GeneratedWrappers.CoreArcGISRuntimeEnvironment.SetInstallDirectory(String installPath) at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.TryInitialize() --- End of inner exception stack trace --- at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.TryInitialize() at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.InitNative() at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.Initialize() at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.OnBeforeFirstUseOfGeneratedWrapper() at RuntimeCoreNet.GeneratedWrappers.CoreWrapperBase..cctor() --- End of inner exception stack trace --- at RuntimeCoreNet.GeneratedWrappers.CoreWrapperBase..ctor(IntPtr handle) at RuntimeCoreNet.GeneratedWrappers.CoreColor..ctor(IntPtr handle) at RuntimeCoreNet.GeneratedWrappers.CoreRGBColor..ctor(IntPtr handle) at RuntimeCoreNet.GeneratedWrappers.CoreRGBColor..ctor(Byte red, Byte green, Byte blue, Byte alpha) at Esri.ArcGISRuntime.Internal.GraphicUtils.FromColorToCore(Color color) at Esri.ArcGISRuntime.Symbology.SimpleFillSymbol..ctor(SimpleFillSymbolStyle style, Color color, LineSymbol outline) at Volcano.Module.Mapping.MapCore.MapViewController..ctor(IEventAggregator eventAggregator) in D:\Projects\VolcanoMapping\Volcano.Module.Mapping\MapCore\MapViewController.cs:line 21 --- End of inner exception stack trace --- at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri) at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri) at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri) at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream) at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator) at Volcano.Module.Mapping.Views.VolcanoMapView.InitializeComponent() at Volcano.Module.Mapping.Views.VolcanoMapView..ctor() in D:\Projects\VolcanoMapping\Volcano.Module.Mapping\Views\VolcanoMapView.xaml.cs:line 9 --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Unity.Processors.ConstructorProcessor.<>c__DisplayClass16_0.<GetResolverDelegate>b__0(BuilderContext& c) at Unity.Processors.MemberProcessor2.<>c__DisplayClass8_0.b__0(BuilderContext& c) at Unity.Processors.MemberProcessor2.<>c__DisplayClass8_0.<GetResolver>b__0(BuilderContext& c) at Unity.Processors.MemberProcessor2.<>c__DisplayClass8_0.b__0(BuilderContext& c) at Unity.UnityContainer.<>c__DisplayClass111_0.b__0(BuilderContext& c) at Unity.Strategies.BuildPlanStrategy.PreBuildUp(BuilderContext& context) at Unity.UnityContainer.<>c.<.ctor>b__73_1(BuilderContext& context) at Unity.UnityContainer.Unity.IUnityContainer.Resolve(Type type, String name, ResolverOverride[] overrides) at Prism.Unity.UnityServiceLocatorAdapter.DoGetInstance(Type serviceType, String key) at CommonServiceLocator.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)'. But also check the InnerExceptions for more detail or call .GetRootException(). ---> CommonServiceLocator.ActivationException: Activation error occurred while trying to get instance of type VolcanoMapView, key "" ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Windows.Markup.XamlParseException: Set property 'Prism.Mvvm.ViewModelLocator.AutoWireViewModel' threw an exception. ---> System.TypeInitializationException: The type initializer for 'RuntimeCoreNet.GeneratedWrappers.CoreWrapperBase' threw an exception. ---> System.InvalidOperationException: Could not load ArcGIS Runtime (RuntimeCoreNet.dll) or one of its dependencies. Ensure "Microsoft Visual C++ 2015-2019 Redistributable" is installed. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (0x8007000B) at RuntimeCoreNet.GeneratedWrappers.CoreArcGISRuntimeEnvironment.CoreRT_ArcGISRuntimeEnvironment_setInstallDirectory(Byte[] installPath, IntPtr& outErrorHandle) at RuntimeCoreNet.GeneratedWrappers.CoreArcGISRuntimeEnvironment.SetInstallDirectory(String installPath) at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.TryInitialize() --- End of inner exception stack trace --- at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.TryInitialize() at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.InitNative() at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.Initialize() at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.OnBeforeFirstUseOfGeneratedWrapper() at RuntimeCoreNet.GeneratedWrappers.CoreWrapperBase..cctor() --- End of inner exception stack trace --- at RuntimeCoreNet.GeneratedWrappers.CoreWrapperBase..ctor(IntPtr handle) at RuntimeCoreNet.GeneratedWrappers.CoreColor..ctor(IntPtr handle) at RuntimeCoreNet.GeneratedWrappers.CoreRGBColor..ctor(IntPtr handle) at RuntimeCoreNet.GeneratedWrappers.CoreRGBColor..ctor(Byte red, Byte green, Byte blue, Byte alpha) at Esri.ArcGISRuntime.Internal.GraphicUtils.FromColorToCore(Color color) at Esri.ArcGISRuntime.Symbology.SimpleFillSymbol..ctor(SimpleFillSymbolStyle style, Color color, LineSymbol outline) at Volcano.Module.Mapping.MapCore.MapViewController..ctor(IEventAggregator eventAggregator) in D:\Projects\VolcanoMapping\Volcano.Module.Mapping\MapCore\MapViewController.cs:line 21 --- End of inner exception stack trace --- at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri) at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri) at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri) at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream) at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator) at Volcano.Module.Mapping.Views.VolcanoMapView.InitializeComponent() at Volcano.Module.Mapping.Views.VolcanoMapView..ctor() in D:\Projects\VolcanoMapping\Volcano.Module.Mapping\Views\VolcanoMapView.xaml.cs:line 9 --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Unity.Processors.ConstructorProcessor.<>c__DisplayClass16_0.b__0(BuilderContext& c) at Unity.Processors.MemberProcessor2.<>c__DisplayClass8_0.<GetResolver>b__0(BuilderContext& c) at Unity.Processors.MemberProcessor2.<>c__DisplayClass8_0.b__0(BuilderContext& c) at Unity.Processors.MemberProcessor2.<>c__DisplayClass8_0.<GetResolver>b__0(BuilderContext& c) at Unity.UnityContainer.<>c__DisplayClass111_0.<OptimizingFactory>b__0(BuilderContext& c) at Unity.Strategies.BuildPlanStrategy.PreBuildUp(BuilderContext& context) at Unity.UnityContainer.<>c.<.ctor>b__73_1(BuilderContext& context) at Unity.UnityContainer.Unity.IUnityContainer.Resolve(Type type, String name, ResolverOverride[] overrides) at Prism.Unity.UnityServiceLocatorAdapter.DoGetInstance(Type serviceType, String key) at CommonServiceLocator.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) --- End of inner exception stack trace --- at CommonServiceLocator.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) at CommonServiceLocator.ServiceLocatorImplBase.GetInstance(Type serviceType) at Prism.Regions.RegionViewRegistry.CreateInstance(Type type) at Prism.Regions.RegionViewRegistry.<>c__DisplayClass8_0.<RegisterViewWithRegion>b__0() at Prism.Regions.Behaviors.AutoPopulateRegionBehavior.OnViewRegistered(Object sender, ViewRegisteredEventArgs e) --- End of inner exception stack trace --- at Prism.Regions.RegionViewRegistry.OnContentRegistered(ViewRegisteredEventArgs e) at Prism.Regions.RegionViewRegistry.RegisterViewWithRegion(String regionName, Func1 getContentDelegate) at Prism.Regions.RegionViewRegistry.RegisterViewWithRegion(String regionName, Type viewType) at Prism.Regions.RegionManager.RegisterViewWithRegion(String regionName, Type viewType) at Volcano.Module.Mapping.MappingModule.OnInitialized(IContainerProvider containerProvider) in D:\Projects\VolcanoMapping\Volcano.Module.Mapping\MappingModule.cs:line 26 at Prism.Modularity.ModuleInitializer.Initialize(IModuleInfo moduleInfo) --- End of inner exception stack trace --- at Prism.Modularity.ModuleInitializer.HandleModuleInitializationError(IModuleInfo moduleInfo, String assemblyName, Exception exception) at Prism.Modularity.ModuleInitializer.Initialize(IModuleInfo moduleInfo) at Prism.Modularity.ModuleManager.LoadModulesThatAreReadyForLoad() at Prism.Modularity.ModuleManager.LoadModulesWhenAvailable() at Prism.Modularity.ModuleManager.Run() at Prism.PrismApplicationBase.InitializeModules() at Prism.PrismApplicationBase.Initialize() at Prism.PrismApplicationBase.InitializeInternal() at Prism.PrismApplicationBase.OnStartup(StartupEventArgs e) at System.Windows.Application.<.ctor>b__1_0(Object unused) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location where exception was thrown --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.Run() at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run() at Volcano.MappingHost.App.Main() in D:\Projects\VolcanoMapping\Volcano.MappingHost\obj\Release\netcoreapp3.1\win-x64\App.g.cs:line 62

Verified the existence of RuntimeCoreNet.dll in the install.

Any ideas as to how to workaround/solve?

@dotMorten
Copy link
Member

Did you see the error message:

Ensure "Microsoft Visual C++ 2015-2019 Redistributable" is installed. --->

Is it?
Also try calling Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.Initialize(); in the beginning of your app.xaml.cs constructor. That should hopefully give you a better/clearer error message, rather then hide deep inside your view model instantiation.

If you're targeting x86 or x64, you should see a runtimecore.dll and runtimecorenet.dll in the output folder. If you're targeting AnyCPU, these files would instead below \runtimes\win-x86\native\ and \runtimes\win-x64\native\. Please check those files are there.

@SteveMcKean
Copy link
Author

On the Initialize(), that's exactly what I've done just a bit ago. I have seen the C++ message and will make sure that's installed.

Right now we target AnyCPU and runtimecore.dll and runtimecorenet.dll are present. However using the publish option on the startup project the \runtimes\win-xxx\native folders don't appear. Assuming those are copied back to the publish directory.

@dotMorten
Copy link
Member

when you publish it's not anycpu and they'll go in the root folder instead

@SteveMcKean
Copy link
Author

I've modified the and removed the PublishSingleFile from the startup projects .csproj and published again. The \runtimes\win-xx\ directories are included in the publish. Both runtimecore.dll && RuntimecoreNet.dll are included and I've installed the C++ 2015-2019 packaged.

Same error occurred: SystemInvalidOperation: Could not load ArcGIS Runtime (RuntimeCoreNet.dll) or one of its dependencies...

@SteveMcKean
Copy link
Author

Added x64 build configuration and published with same results as above. ;(

@dotMorten
Copy link
Member

@SteveMcKean I think this discussion should be moved to GeoNet, as this isn't really the appropriate place .Perhaps repost there, and also share an app that reproduces the issue.

@SteveMcKean
Copy link
Author

Agreed.

@SteveMcKean
Copy link
Author

SteveMcKean commented Mar 29, 2020 via email

@jf990
Copy link
Contributor

jf990 commented Jun 19, 2020

Issue discussion was moved to GeoNet.

@jf990 jf990 closed this as completed Jun 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants