title: Why does the R type provider throw an exception when it does not in a similar installation?
body: <p>I have two computers with seemingly equal code and configurations, one compiles a solution, the other does not.</p>
  
  <p>The problem is related to the <code>R Type Provider</code>. </p>
  
  <p>This is the code:</p>
  
  <pre><code>/// Path to project data folder.
  [&lt;Literal&gt;]
  let projDataPath = __SOURCE_DIRECTORY__ + @"\data\"
  
  [&lt;Literal&gt;]
  let jsonPath = projDataPath + "fractal.json"
  type PathInfo = JsonProvider&lt;Sample=jsonPath&gt;
  
  /// Csv provider for files with information about assets
  type AssetsInfo = CsvProvider&lt;Sample="AssetInfoFS.csv", // must be a Literal
                                HasHeaders=true,
                                ResolutionFolder=projDataPath,
                                AssumeMissingValues=false,
                                CacheRows=false&gt;
  
  [&lt;Literal&gt;]
  let configPath = projDataPath + "config.json"
  type Cnfg = JsonProvider&lt;Sample=configPath&gt;
  </code></pre>
  
  <p>Both computer are running <code>Windows 10</code>, the one where the code does not compile is running the <code>Home</code> version, the other one is running the <code>Pro</code> version.</p>
  
  <p>Both computers have <code>Visual Studio Community 2017 Version 15.7.2</code> installed.</p>
  
  <p><strong>Configuration</strong></p>
  
  <p><strong>Application:</strong></p>
  
  <p>Target F# runtime: <code>4.4.3.0</code></p>
  
  <p>Target Framework: <code>.NET Framework 4.6.1</code></p>
  
  <p>Output type: <code>Console Application</code></p>
  
  <p><strong>Build:</strong></p>
  
  <p>Platform Target: <code>Any CPU</code></p>
  
  <p>Other flags: <code>Prefer 32-bit</code></p>
  
  <p><strong>Installed packages:</strong></p>
  
  <p><code>R.NET Community v1.65</code></p>
  
  <p><code>R.NET Community,FSharp v1.65</code></p>
  
  <p><code>RProvider v1.1.2.0</code></p>
  
  <p><strong>R version:</strong></p>
  
  <p>Tried with <code>R 3.4.3</code> and <code>R 3.5.0</code>, in both cases the 32-bit and 64-bit versions were installed.</p>
  
  <p><strong>Error message:</strong></p>
  
  <pre><code>parse error FS3053: error : The type provider constructor has thrown an exception: Initialization of R.NET failed
  1&gt;FSC: warning FS3005: Referenced assembly 'C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\RProvider.dll' has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were found
  1&gt;Done building project "Fractal13.fsproj" -- FAILED.
  </code></pre>
  
  <p>There were some old questions on the web and in SO related to this but no clear solution. Any suggestions for solving this problem?</p>
  
  <p><strong>EDIT:</strong> </p>
  
  <p>Following Tomas Petricek's suggestion in a comment I obtained the following log:</p>
  
  <pre><code>[5/26/2018 7:45:20 AM] [Pid:12476, Tid:44, Apid:1] initAndGenerate: starting
  [5/26/2018 7:45:20 AM] [Pid:12476, Tid:44, Apid:1] Starting server 'C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\RProvider.Server.exe' with arguments 'RInteropServer_12476_457625_1311358896 "C:\Users\fsald\AppData\Local\Temp\tmpFB99.tmp"' (exists=true)
  [5/26/2018 7:45:20 AM] [Pid:4948, Tid:1, Apid:1] Starting 'RProvider.Server' with arguments '[|"RInteropServer_12476_457625_1311358896";
    "C:\Users\fsald\AppData\Local\Temp\tmpFB99.tmp"|]'
  [5/26/2018 7:45:20 AM] [Pid:4948, Tid:1, Apid:1] Registering RInteropServer at channel 'RInteropServer_12476_457625_1311358896'
  [5/26/2018 7:45:20 AM] [Pid:4948, Tid:1, Apid:1] Ready for connections..
  [5/26/2018 7:45:20 AM] [Pid:4948, Tid:1, Apid:1] Attempting resolution for 'RDotNet, Version=1.6.5.0, Culture=neutral, PublicKeyToken=null'
  [5/26/2018 7:45:21 AM] [Pid:4948, Tid:1, Apid:1] Probing locations: C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\Accord.3.8.0\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\Accord.MachineLearning.3.8.0\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\Accord.MachineLearning.GPL.3.8.0\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\Accord.Math.3.8.0\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\Accord.Statistics.3.8.0\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\Deedle.1.2.5\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\DynamicInterop.0.7.4\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\FSharp.Date.0.3\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\MathNet.Numerics.4.4.1\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\Newtonsoft.Json.9.0.1\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\numl.0.8.26.0\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\R.NET.Community.1.6.5\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\R.NET.Community.FSharp.1.6.5\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\RProvider.1.1.20\lib\net40
  [5/26/2018 7:45:21 AM] [Pid:4948, Tid:1, Apid:1] Found assembly, checking version! (C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\R.NET.Community.1.6.5\lib\net40\RDotNet.dll)
  [5/26/2018 7:45:21 AM] [Pid:4948, Tid:1, Apid:1] ...version matches, returning!
  [5/26/2018 7:45:21 AM] [Pid:4948, Tid:1, Apid:1] Attempting resolution for 'DynamicInterop, Version=0.7.4.0, Culture=neutral, PublicKeyToken=null'
  [5/26/2018 7:45:21 AM] [Pid:4948, Tid:1, Apid:1] Probing locations: C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\Accord.3.8.0\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\Accord.MachineLearning.3.8.0\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\Accord.MachineLearning.GPL.3.8.0\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\Accord.Math.3.8.0\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\Accord.Statistics.3.8.0\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\Deedle.1.2.5\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\DynamicInterop.0.7.4\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\FSharp.Date.0.3\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\MathNet.Numerics.4.4.1\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\Newtonsoft.Json.9.0.1\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\numl.0.8.26.0\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\R.NET.Community.1.6.5\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\R.NET.Community.FSharp.1.6.5\lib\net40;C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\RProvider.1.1.20\lib\net40
  [5/26/2018 7:45:21 AM] [Pid:4948, Tid:1, Apid:1] Found assembly, checking version! (C:\Projects\bitbucket3\VSProjects\Fractal13\packages\RProvider.1.1.20\lib\net40\..\..\..\DynamicInterop.0.7.4\lib\net40\DynamicInterop.dll)
  [5/26/2018 7:45:21 AM] [Pid:4948, Tid:1, Apid:1] ...version matches, returning!
  [5/26/2018 7:45:21 AM] [Pid:4948, Tid:1, Apid:1] findRHomePath
  [5/26/2018 7:45:21 AM] [Pid:4948, Tid:1, Apid:1] getRLocation
  [5/26/2018 7:45:21 AM] [Pid:4948, Tid:1, Apid:1] Scanning the registry
  [5/26/2018 7:45:21 AM] [Pid:4948, Tid:1, Apid:1] findRHomePath: file='C:\Program Files\R\R-3.5.0\bin\x64\R.dll'
  [5/26/2018 7:45:21 AM] [Pid:12476, Tid:44, Apid:1] generateTypes: getting packages
  [5/26/2018 7:45:21 AM] [Pid:4948, Tid:5, Apid:1] Adding work item to queue
  [5/26/2018 7:45:21 AM] [Pid:4948, Tid:1, Apid:1] server event loop: got work item
  [5/26/2018 7:45:21 AM] [Pid:4948, Tid:1, Apid:1] eval(.packages(all.available=T))
  [5/26/2018 7:45:21 AM] [Pid:4948, Tid:1, Apid:1] engine: Creating and initializing instance (sizeof&lt;IntPtr&gt;=8)
  [5/26/2018 7:45:21 AM] [Pid:4948, Tid:1, Apid:1] engine: Creating instance failed:
    System.NullReferenceException: Object reference not set to an instance of an object.
     at RDotNet.SymbolicExpression..ctor(REngine engine, IntPtr pointer)
     at RDotNet.ExpressionVector.GetValue(Int32 index)
     at RDotNet.ExpressionVector.get_Item(Int32 index)
     at RDotNet.Vector`1.&lt;GetEnumerator&gt;d__0.MoveNext()
     at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
     at RDotNet.REngine.Parse(String statement, StringBuilder incompleteStatement)
     at RDotNet.REngine.&lt;Defer&gt;d__0.MoveNext()
     at System.Linq.Enumerable.LastOrDefault[TSource](IEnumerable`1 source)
     at RDotNet.REngine.Evaluate(String statement)
     at RDotNet.REngine.Initialize(StartupParameter parameter, ICharacterDevice device, Boolean setupMainLoop)
     at RDotNet.REngine.GetInstance(String dll, Boolean initialize, StartupParameter parameter, ICharacterDevice device)
     at RProvider.Internal.RInit.engine@119.Invoke() in C:\Tomas\Public\bmc\FSharp.RProvider\src\RProvider\RInit.fs:line 126
  [5/26/2018 7:45:21 AM] [Pid:4948, Tid:1, Apid:1] Output: 
  [5/26/2018 7:45:21 AM] [Pid:4948, Tid:1, Apid:1] Operation failed:
    System.Exception: Initialization of R.NET failed ---&gt; System.NullReferenceException: Object reference not set to an instance of an object.
     at RDotNet.SymbolicExpression..ctor(REngine engine, IntPtr pointer)
     at RDotNet.ExpressionVector.GetValue(Int32 index)
     at RDotNet.ExpressionVector.get_Item(Int32 index)
     at RDotNet.Vector`1.&lt;GetEnumerator&gt;d__0.MoveNext()
     at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
     at RDotNet.REngine.Parse(String statement, StringBuilder incompleteStatement)
     at RDotNet.REngine.&lt;Defer&gt;d__0.MoveNext()
     at System.Linq.Enumerable.LastOrDefault[TSource](IEnumerable`1 source)
     at RDotNet.REngine.Evaluate(String statement)
     at RDotNet.REngine.Initialize(StartupParameter parameter, ICharacterDevice device, Boolean setupMainLoop)
     at RDotNet.REngine.GetInstance(String dll, Boolean initialize, StartupParameter parameter, ICharacterDevice device)
     at RProvider.Internal.RInit.engine@119.Invoke() in C:\Tomas\Public\bmc\FSharp.RProvider\src\RProvider\RInit.fs:line 126
     --- End of inner exception stack trace ---
     at RProvider.Internal.RInit.engine@119.Invoke() in C:\Tomas\Public\bmc\FSharp.RProvider\src\RProvider\RInit.fs:line 137
     at System.Lazy`1.CreateValue()
     at System.Lazy`1.LazyInitValue()
     at RProvider.RInteropInternal.eval@292.Invoke(Unit unitVar0) in C:\Tomas\Public\bmc\FSharp.RProvider\src\RProvider\RInterop.fs:line 293
     at RProvider.Internal.Logging.logWithOutput[a](CharacterDeviceInterceptor characterDevice, FSharpFunc`2 f) in C:\Tomas\Public\bmc\FSharp.RProvider\src\RProvider\Logging.fs:line 57
  [5/26/2018 7:45:21 AM] [Pid:12476, Tid:44, Apid:1] RProvider constructor failed: System.Exception: Initialization of R.NET failed ---&gt; System.NullReferenceException: Object reference not set to an instance of an object.
     at RDotNet.SymbolicExpression..ctor(REngine engine, IntPtr pointer)
     at RDotNet.ExpressionVector.GetValue(Int32 index)
     at RDotNet.ExpressionVector.get_Item(Int32 index)
     at RDotNet.Vector`1.&lt;GetEnumerator&gt;d__0.MoveNext()
     at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
     at RDotNet.REngine.Parse(String statement, StringBuilder incompleteStatement)
     at RDotNet.REngine.&lt;Defer&gt;d__0.MoveNext()
     at System.Linq.Enumerable.LastOrDefault[TSource](IEnumerable`1 source)
     at RDotNet.REngine.Evaluate(String statement)
     at RDotNet.REngine.Initialize(StartupParameter parameter, ICharacterDevice device, Boolean setupMainLoop)
     at RDotNet.REngine.GetInstance(String dll, Boolean initialize, StartupParameter parameter, ICharacterDevice device)
     at RProvider.Internal.RInit.engine@119.Invoke() in C:\Tomas\Public\bmc\FSharp.RProvider\src\RProvider\RInit.fs:line 126
     --- End of inner exception stack trace ---
  
  Server stack trace: 
     at RProvider.Server.EventLoop.runServerCommandSafe[a](FSharpFunc`2 f) in C:\Tomas\Public\bmc\FSharp.RProvider\src\RProvider\RInteropServer.fs:line 63
     at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]&amp; outArgs)
     at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
  
  Exception rethrown at [0]: 
     at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
     at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)
     at RProvider.Internal.IRInteropServer.GetPackages()
     at RProvider.RTypeBuilder.generateTypes@26-2.GenerateNext(IEnumerable`1&amp; next) in C:\Tomas\Public\bmc\FSharp.RProvider\src\RProvider.DesignTime\RTypeBuilder.fs:line 27
     at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl()
     at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.System-Collections-IEnumerator-MoveNext()
     at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source)
     at RProvider.RTypeBuilder.generateTypes@24-1.GenerateNext(IEnumerable`1&amp; next) in C:\Tomas\Public\bmc\FSharp.RProvider\src\RProvider.DesignTime\RTypeBuilder.fs:line 25
     at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl()
     at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.System-Collections-IEnumerator-MoveNext()
     at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source)
     at RProvider.RInteropClient.withServer[a](FSharpFunc`2 f) in C:\Tomas\Public\bmc\FSharp.RProvider\src\RProvider.DesignTime\RInteropClient.fs:line 121
     at RProvider.RTypeBuilder.initAndGenerate@104.GenerateNext(IEnumerable`1&amp; next) in C:\Tomas\Public\bmc\FSharp.RProvider\src\RProvider.DesignTime\RTypeBuilder.fs:line 109
     at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl()
     at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.System-Collections-IEnumerator-MoveNext()
     at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source)
     at RProvider.RProvider.buildTypes() in C:\Tomas\Public\bmc\FSharp.RProvider\src\RProvider.DesignTime\RProvider.fs:line 32
  </code></pre>