or-tools: Windows net452 framework is broken

Details: Version: 7.5 from NuGet, Windows 10, C#, Routing Solver,

I built the project and when calling it (via URL) the code reached the part that initializes the IndexManager, with valid parameters, and gets an immediate exception:

RoutingIndexManager manager = new RoutingIndexManager(number_of_locations, number_of_vehicles, vehicle_starts_, vehicle_ends_);
**<InnerException>**
<Message>An error has occurred.</Message>
<ExceptionMessage>
 'SWIGExceptionHelper'.
</ExceptionMessage>
<ExceptionType>System.TypeInitializationException</ExceptionType>
<StackTrace>
ב- Google.OrTools.ConstraintSolver.operations_research_constraint_solverPINVOKE.SWIGExceptionHelper..ctor() ב- Google.OrTools.ConstraintSolver.operations_research_constraint_solverPINVOKE..cctor()
</StackTrace>
<InnerException>
<Message>An error has occurred.</Message>
<ExceptionMessage>
Cannot load DLL 'google-ortools-native'. Access is denied. (HRESULT: 0x80070005 (E_ACCESSDENIED))
</ExceptionMessage>
<ExceptionType>System.DllNotFoundException</ExceptionType>
<StackTrace>
Google.OrTools.ConstraintSolver.operations_research_constraint_solverPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_operations_research_constraint_solver(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate) ב- Google.OrTools.ConstraintSolver.operations_research_constraint_solverPINVOKE.SWIGExceptionHelper..cctor()
</StackTrace>
</InnerException>
</InnerException>
</Error>

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 84 (16 by maintainers)

Most upvoted comments

what happens if you put <TargetFramework>net452;netcoreapp2.1</TargetFramework> I’d suggest it will find a compromise between the 2 sdk versions

Thanks. So summary, OrTools work as expected on Netstandard, NetCore, Netframework. Nothing broken in “Windows net452 framework” or OrTools.

The problems seem to be caused by not using the default mechanisms given by the IDE to create a project and install a Nuget package. Especially mixing things netframework/netcore, msbuild/dotnet-cli, old csproj Project format and new csproj Project format will lead to unexpected results.

Where do I do this?

Great news. Can you please explain the steps to take?

if I copy .nuget\packages\google.ortools.runtime.win-x64\7.5.7466\runtimes\win-x64\native\google-ortools-native.dll in bin\Debug\net452\google-ortools-native.dll it works

So it seems in net452 we are missing something…

note: on the contrary we have a bin\Debug\netcoreapp2.1\Google.OrTools.VrpStartsEnds.deps.json with

     "Google.OrTools.runtime.win-x64/7.5.7466": {
        "runtimeTargets": {
          "runtimes/win-x64/native/google-ortools-native.dll": {
            "rid": "win-x64",
            "assetType": "native",
            "fileVersion": "0.0.0.0"
          }
        }
      },