#470 .NET runtime

skaranam Thu 19 Feb 2009

I am trying a test program for java and .net interoperability. The hello test program works fine with default runtime (java) settings. But not working when I changed the runtime to .NET. I changed fan.runtime to dotnet in sys.props file.

fan - version shows following error . What is missing in my environment / settings?

Thanks in advance

ERROR: Sys.static System.Exception: Invalid fan.home dir: 7C:\app\eng\sdk\fan-1.0.38 sys::Sys.sysPropToDir (Sys.cs:415) sys::Sys..cctor (Sys.cs:149) System.TypeInitializationException: The type initializer for Fan.Sys.Sys threw an exception. sys::Sys.get_HomeDir (Unknown Source) at Fanx.Tools.Tool.verifyDlls (Tool.cs:154) at Fanx.Tools.Tool.sysInit (Tool.cs:139) The type initializer for Fan.Sys.Sys threw an exception. sys::Sys..cctor (Sys.cs:378) Fan Launcher Copyright (c) 2006-2008, Brian Frank and Andy Frank Licensed under the Academic Free License version 3.0

.NET Runtime:

clr.version: 2.0.50727.3074
System.TypeInitializationException: The type initializer for 'Fan.Sys.Sys' threw an exception.
  sys::Sys.get_HomeDir (Unknown Source)
  at Fanx.Tools.Fan.version (Fan.cs:161)
  at Fanx.Tools.Fan.doRun (Fan.cs:221)
  at Fanx.Tools.Fan.MainThread.run (Fan.cs:200)
  sys::Thread.doRun (Thread.cs:335)
The type initializer for 'Fan.Sys.Sys' threw an exception.
  sys::Sys..cctor (Sys.cs:378)

andy Thu 19 Feb 2009

Unless you have a typo in there you're fan.home is:

7C:\app\eng\sdk\fan-1.0.38 

Is that what its saying?

skaranam Thu 19 Feb 2009

I didn't set fan.home explicitly and I believe, launcher is recognizing it automatically.

fan -version displays the following when the runtime is java

Fan Launcher Copyright (c) 2006-2008, Brian Frank and Andy Frank Licensed under the Academic Free License version 3.0

Java Runtime:

java.vm.name:    Java HotSpot(TM) Client VM
java.vm.vendor:  Sun Microsystems Inc.
java.vm.version: 11.0-b16
java.home:       C:\app\eng\sdk\Java\jre6
fan.home:        C:\app\eng\sdk\fan-1.0.38
sys.version:     1.0.38

But, when the runtime is dotnet, fan -version shows above error and the fan.home is displayed as 7C:\app\eng\sdk\fan-1.0.38 in that error.

andy Thu 19 Feb 2009

If you explicitly set it does it work?

C:>set fan_home=C:\app\eng\sdk\fan-1.0.38

Also you can dump debug information using:

C:>fan --v -version

skaranam Fri 20 Feb 2009

Hi Andy, still need your help to get me out of this :-)

I did set fan_home correctly in the environment. I verified that using SET command of windows.

Additional info if it helps; I am using Windows Vista Home Edition and .NET runtime is installed at C:\Windows\Microsoft.NET\Framework\v2.0.50727. Also, in the same Framework folder, I do have other versions of .NET runtime including v3.0 and v3.5 (is that causing the problem?).

Below is the debug information;

C:\trash>fan --v -version
-- launcher version 1.0 3-Jan-07
--   args[0] = "fan"
--   args[1] = "--v"
--   args[2] = "-version"
-- init
--   fanHome = C:\app\eng\sdk\fan-1.0.38
--   sys.props:
--     fan.runtime=dotnet
--     fan.java.options=-Xmx128M
--     sql.mysql.driver=com.mysql.jdbc.Driver
--     sql.test.connection=jdbc:mysql:
--     sql.test.username=fantest
--     sql.test.password=fantest
--     sql.test.dialect=sql::MySqlDialect
--     fan.runtime.substitutes=/C:/dev/fan/src/buildall.fan           = C:\dev\r
el  /C:/dev/fan/src/buildboot.fan          = C:\dev\rel  /C:/dev/fan/src/jfan/bu
ild.fan         = C:\dev\rel  /C:/dev/fan/src/nfan/build.fan         = C:\dev\re
l  /C:/dev/fan/src/sys/build.fan          = C:\dev\rel  /C:/dev/fan/src/compiler
/build.fan     = C:\dev\rel  /C:/dev/fan/src/compilerJava/build.fan = C:\dev\rel
  /C:/dev/fan/src/build/build.fan        = C:\dev\rel
--     fan.build.globalVersion=1.0.38
--     fan.build.jdkHome=/C:/dev/tools/java/
--     fan.build.dotnetHome=/C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/
-- parseArgs
--   fanArgs (1)
--     [0] -version
-- checkSubstitutes
--   targetUri = /C:/trash/-version
--     /C:/dev/fan/src/buildall.fan = C:\dev\rel
--     /C:/dev/fan/src/buildboot.fan = C:\dev\rel
--     /C:/dev/fan/src/jfan/build.fan = C:\dev\rel
--     /C:/dev/fan/src/nfan/build.fan = C:\dev\rel
--     /C:/dev/fan/src/sys/build.fan = C:\dev\rel
--     /C:/dev/fan/src/compiler/build.fan = C:\dev\rel
--     /C:/dev/fan/src/compilerJava/build.fan = C:\dev\rel
--     /C:/dev/fan/src/build/build.fan = C:\dev\rel
-- getRuntime = dotnet
-- findDotnetVer
--   registry keys:
--     AppPatch
--     Standards
--     Upgrades
--     v2.0
-- loadClr
--   load mscoree.dll
--   sysPath = C:\app\eng\sdk\fan-1.0.38\lib\dotnet\sys.dll
--   fan.main = ERROR: Sys.static
System.Exception: Invalid fan.home dir: ◄C:\app\eng\sdk\fan-1.0.38
  sys::Sys.sysPropToDir (Sys.cs:415)
  sys::Sys..cctor (Sys.cs:149)
System.TypeInitializationException: The type initializer for 'Fan.Sys.Sys' threw
 an exception.
  sys::Sys.get_HomeDir (Unknown Source)
  at Fanx.Tools.Tool.verifyDlls (Tool.cs:154)
  at Fanx.Tools.Tool.sysInit (Tool.cs:139)
 The type initializer for 'Fan.Sys.Sys' threw an exception.
   sys::Sys..cctor (Sys.cs:378)
Fan Launcher
Copyright (c) 2006-2008, Brian Frank and Andy Frank
Licensed under the Academic Free License version 3.0

.NET Runtime:
  clr.version: 2.0.50727.3074
System.TypeInitializationException: The type initializer for 'Fan.Sys.Sys' threw
 an exception.
  sys::Sys.get_HomeDir (Unknown Source)
  at Fanx.Tools.Fan.version (Fan.cs:161)
  at Fanx.Tools.Fan.doRun (Fan.cs:221)
  at Fanx.Tools.Fan.MainThread.run (Fan.cs:200)
  sys::Thread.doRun (Thread.cs:335)
 The type initializer for 'Fan.Sys.Sys' threw an exception.
   sys::Sys..cctor (Sys.cs:378)
--   Managed code returned 0
--   HRESULT = 0

skaranam Sat 21 Feb 2009

Thank you Andy, the modified fan.exe that you had mailed is working good for .net runtime.

Thanks again to both you and Brian for this wonderful FAN :-)

andy Sat 21 Feb 2009

Cool. This bug is probably happening to everyone, but for some reason my machine (and I assume others?) work anyways. So maybe it was Vista (I'm on WinXP). In any event I pushed a fix and updated exe's to mercurial.

Login or Signup to reply.