#748 NAnt 0.91 Aplha 2 crashes on startup

0.91-alpha2
open
nobody
Core (183)
5
2010-08-19
2010-08-18
Anonymous
No

I'm running nant on windows 7 x64 and getting the following exception (german). nant crashes in user mode and with elavated rights in admin mode.

Unbehandelte Ausnahme: System.TypeInitializationException: Der Typeninitialisierer für "NAnt.Console.ConsoleStub" hat ei
ne Ausnahme verursacht. ---> System.Security.SecurityException: Fehler bei der Anforderung des Berechtigungstyps "System
.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".
bei System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
bei System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& stackMark)
bei System.Security.CodeAccessPermission.Demand()
bei System.AppDomainSetup.VerifyDir(String dir, Boolean normalize)
bei System.AppDomain.get_BaseDirectory()
bei log4net.Config.XmlConfiguratorAttribute.Configure(Assembly sourceAssembly, ILoggerRepository targetRepository)
bei log4net.Core.DefaultRepositorySelector.ConfigureRepository(Assembly assembly, ILoggerRepository repository)
bei log4net.Core.DefaultRepositorySelector.CreateRepository(Assembly repositoryAssembly, Type repositoryType, String
repositoryName, Boolean readAssemblyAttributes)
bei log4net.Core.DefaultRepositorySelector.CreateRepository(Assembly repositoryAssembly, Type repositoryType)
bei log4net.Core.DefaultRepositorySelector.GetRepository(Assembly repositoryAssembly)
bei log4net.Core.LoggerManager.GetLogger(Assembly repositoryAssembly, String name)
bei log4net.LogManager.GetLogger(Assembly repositoryAssembly, String name)
bei log4net.LogManager.GetLogger(Type type)
bei NAnt.Console.ConsoleStub..cctor()
--- Ende der internen Ausnahmestapelüberwachung ---
bei NAnt.Console.ConsoleStub.Main(String[] args)

Discussion

  • Ryan Boggs
    Ryan Boggs
    2010-08-19

    Can you please send the file that you are trying to build (or a simplified build file if it contains sensitive information)?

     
  • Ryan Boggs
    Ryan Boggs
    2010-08-19

    • milestone: --> 0.91-alpha2
     

  • Anonymous
    2010-08-19

    I tried to compile the current Boo master. But it's not neccessary to crash nant. I just started the exe without a build file. I copied the libs from bin\lib\net\1.0 over to bin\lib\net\4.0 just to have them in place. anything else is quite standard.

     
  • Ryan Boggs
    Ryan Boggs
    2010-08-19

    Are you saying that copying the libs from bin\lib\net\1.0 to bin\lib\net\4.0 fixed the issue?

     
  • Ryan Boggs
    Ryan Boggs
    2010-08-20

    Just out of curiosity, what versions of .NET do you have installed?

     

  • Anonymous
    2010-08-21

    no, copying the files didn't fix it. Win7 includes 3.5. I've got 4.0 client and extended installed, along with the 7 SDK and the .NET 2.0 SDK. The 0.90 doesn't crash. I'll try debugging it. Are there any hints on how to best debug nant.

     

  • Anonymous
    2010-08-21

    Finally, I was able to compile boo with a rebuild version of nant compiled with the 4.0 profile. I built nant 0.91 alpha2 with 0.90 and target 4.0. This is the only way to compile boo (at least for me). Having a nant compiled against a .NET 4.0 profile

     
  • Ryan Boggs
    Ryan Boggs
    2010-08-22

    I am unable to replicate this on my test box. I find it odd that the binaries fail but compiling from source works. In your last post, you said that building the last alpha with 0.90 worked. Have you tried building 0.91 Alpha2 from scratch with either nmake or gmake? Could you give that a try and let us know how that works? The commands to build should be in the tar balls.

    Also, to answer your question about debugging NAnt, I usually add the -v+ and -debug+ arguments in the command line when I am building a project with NAnt.

     

  • Anonymous
    2010-08-22

    i did the bootstrap manually, but used the 4.0 profile. using gmake from my perl bin doesn't work. what version are you using? there is a missing blank blank. i'd try another version of gmake. which one should i use?

    PS > gmake install prefix="c:\shared\tools\nant-test"
    mkdir -p bootstrap
    cp -R lib/ bootstrap/lib
    # Mono loads log4net before privatebinpath is set-up, so we need this in the same directory
    # as NAnt.exe
    cp lib/common/neutral/log4net.dll bootstrap
    cp src/NAnt.Console/App.config bootstrap/NAnt.exe.config
    mcs -target:exe -define:MONO -out:bootstrap\\NAnt.exe -r:bootstrap\\log4net.dll \ -recurse:src\\NAnt.Console\\*.cs src\\CommonAssemblyInfo.cs
    /c/Program Files (x86)/Mono-2.6.7/bin/mcs: /c/Projects/oss/nant-0.91-alpha2/C:/PROGRA~2/MONO-2~1.7/bin/mono: No such fil
    e or directory
    /c/Program Files (x86)/Mono-2.6.7/bin/mcs: exec: /c/Projects/oss/nant-0.91-alpha2/C:/PROGRA~2/MONO-2~1.7/bin/mono: canno
    t execute: No such file or directory
    gmake: *** [bootstrap/NAnt.exe] Error 126

     

  • Anonymous
    2010-08-22

    using nmake did the job, boostrapped nant and installed it right into the place.

    lessons i learned:

    1. I haven't installed .NET 2.0 SDK
    2. The NAnt.exe.config has no supported runtime specified
    3. Using NAnt boostraped with target 4.0 did the job, becaus i really have to run nant under 4.0 profile. Boo boostrapps itself the Boo.NAnt.Tasks.dll. This assembly gets compiled with the 4.0 Framework (this is what I'm interessted in).
    4. setting the supportedRuntime attribute to 4.0 and using nant build with 3.5 profile worked, too.

    So it seems like i should have .NET Framework 2.0 installed on my notebook. I don't really know what caused my problems crashing nant on startup. May it be that NAnt requires vanilla .NET 2.0 (not 3.5).

    Neverthe less. Building boo only succeeds running under 4.0 because the Boo.NAnt.Tasks.dll is boostrapped and build with the 4.0 profile. And this bootstrapped assembly is used within the build file ...

    In the end it doesn't really matter how I'm going to run nant with the 4.0 Profile. But it's neccessary. Either by specifying it as supportedRuntim or by boostrapping it with the 4.0 target.

    cheers,

     
  • Tony Langford
    Tony Langford
    2010-09-10

    Use CC.net to run nant. Coming from 0.90 with no problems to 0.91 Alpha2 and now get the same error be it running nant.exe with no params, with a build file that is empty, or with the build file I use on 0.90. Doesn't matter if i run from cmd with admin either.

    Unhandled Exception: System.TypeInitializationException: The type initializer fo
    r 'NAnt.Console.ConsoleStub' threw an exception. ---> System.Security.SecurityEx
    ception: Request for the permission of type 'System.Security.Permissions.FileIOP
    ermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c5619
    34e089' failed.
    at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMa
    rk& stackMark, Boolean isPermSet)
    at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, S
    tackCrawlMark& stackMark)
    at System.Security.CodeAccessPermission.Demand()
    at System.AppDomainSetup.VerifyDir(String dir, Boolean normalize)
    at System.AppDomain.get_BaseDirectory()
    at log4net.Config.XmlConfiguratorAttribute.Configure(Assembly sourceAssembly,
    ILoggerRepository targetRepository)
    at log4net.Core.DefaultRepositorySelector.ConfigureRepository(Assembly assemb
    ly, ILoggerRepository repository)
    at log4net.Core.DefaultRepositorySelector.CreateRepository(Assembly repositor
    yAssembly, Type repositoryType, String repositoryName, Boolean readAssemblyAttri
    butes)
    at log4net.Core.DefaultRepositorySelector.CreateRepository(Assembly repositor
    yAssembly, Type repositoryType)
    at log4net.Core.DefaultRepositorySelector.GetRepository(Assembly repositoryAs
    sembly)
    at log4net.Core.LoggerManager.GetLogger(Assembly repositoryAssembly, String n
    ame)
    at log4net.LogManager.GetLogger(Assembly repositoryAssembly, String name)
    at log4net.LogManager.GetLogger(Type type)
    at NAnt.Console.ConsoleStub..cctor()
    --- End of inner exception stack trace ---
    at NAnt.Console.ConsoleStub.Main(String[] args)

    Running on 2008r2, VS2008, VS2010, .net 3.51 & 4

    Need this working quite urgently as out projects are now .net 4.... don't really want to rewrite the scripts into Visual Build.

     
  • Ryan Boggs
    Ryan Boggs
    2010-09-13

    Tonst,
    I understand the frustration. Thanks for your exception output, it'll help track this thing down. In the meantime, for your situation and if you have the necessary access, might I suggest building nant 0.91 Alpha2 from source? It seems others who have run into similar issues were able to get around them by building it themselves. I hope this helps.

    Thanks,
    Ryan

     
  • Tony Langford
    Tony Langford
    2010-09-13

    Thanks, that did seem to do the job :)
    The 0.91alpha2 build script failed at the end but it had produced the needed binaries so not a big deal for me but in case its of use here's the end of the log. Used nant 0.9 on 2008r2 to build it:

    [exec] [nant] C:\nant-0.91-alpha2\tests\NAnt.Win32\NAnt.Win32.build te
    st
    [exec] Buildfile: file:///C:/nant-0.91-alpha2/tests/NAnt.Win32/
    NAnt.Win32.build
    [exec] Target framework: Microsoft .NET Framework 3.5
    [exec] Target(s) specified: test
    [exec]
    [exec]
    [exec] build:
    [exec]
    [exec]
    [exec] test:
    [exec]
    [exec] [nunit2] Tests run: 2, Failures: 1, Not run: 0, Time:
    1.685 seconds
    [exec] [nunit2]
    [exec] [nunit2] Failures:
    [exec] [nunit2] 1) Tests.NAnt.Win32.Tasks.ReadRegistryTest.T
    est_Read_Defaults : Tests.NAnt.Core.TestBuildException : Error Executing Project

    [exec] [nunit2] Build Log:
    [exec] [nunit2]
    [exec] [nunit2]
    [exec] [nunit2] ----> NAnt.Core.BuildException : Registry
    Value Not Found! - key='SOFTWARE\Microsoft\Windows\CurrentVersion\\ProductId';hi
    ve='LocalMachine';
    [exec] [nunit2] at Tests.NAnt.Core.BuildTestBase.ExecuteP
    roject(Project p) in c:\nant-0.91-alpha2\tests\NAnt.Core\BuildTestBase.cs:line 1
    63
    [exec] [nunit2] at Tests.NAnt.Core.BuildTestBase.RunBuild
    (String xml, Level level) in c:\nant-0.91-alpha2\tests\NAnt.Core\BuildTestBase.c
    s:line 112
    [exec] [nunit2] at Tests.NAnt.Core.BuildTestBase.RunBuild
    (String xml) in c:\nant-0.91-alpha2\tests\NAnt.Core\BuildTestBase.cs:line 85
    [exec] [nunit2] at Tests.NAnt.Win32.Tasks.ReadRegistryTes
    t.Test_Read_Defaults() in c:\nant-0.91-alpha2\tests\NAnt.Win32\Tasks\ReadRegistr
    yTest.cs:line 41
    [exec] [nunit2] --TestBuildException
    [exec] [nunit2] at NAnt.Win32.Tasks.ReadRegistryTask.Exec
    uteTask() in c:\nant-0.91-alpha2\src\NAnt.Win32\Tasks\ReadRegistryTask.cs:line 1
    55
    [exec] [nunit2] at NAnt.Core.Task.Execute() in c:\nant-0.
    91-alpha2\src\NAnt.Core\Task.cs:line 187
    [exec] [nunit2] at NAnt.Core.Project.InitializeProjectDoc
    ument(XmlDocument doc) in c:\nant-0.91-alpha2\src\NAnt.Core\Project.cs:line 1465

    [exec] [nunit2] at NAnt.Core.Project.Execute() in c:\nant
    -0.91-alpha2\src\NAnt.Core\Project.cs:line 974
    [exec] [nunit2] at Tests.NAnt.Core.BuildTestBase.ExecuteP
    roject(Project p) in c:\nant-0.91-alpha2\tests\NAnt.Core\BuildTestBase.cs:line 1
    52
    [exec] [nunit2]
    [exec] [nunit2]
    [exec] [nunit2]
    [exec]
    [exec] BUILD FAILED
    [exec]
    [exec] C:\nant-0.91-alpha2\tests\NAnt.Win32\NAnt.Win32.build(29
    ,10):
    [exec] Tests Failed.
    [exec]
    [exec] Total time: 2.5 seconds.
    [exec]
    [exec]
    [exec] BUILD FAILED
    [exec]
    [exec] Nested build failed. Refer to build log for exact reason.
    [exec]
    [exec] Total time: 42.5 seconds.
    [exec]

    BUILD FAILED

     
  • Ryan Boggs
    Ryan Boggs
    2010-09-14

    Looks like some tests failed concerning the registry. The user account you were using may not have access to the registry.

     
  • Brandon Arp
    Brandon Arp
    2011-01-21

    I had this exact same problem. It comes from the assembly not being trusted. Windows 7 will put a flag on downloaded files that the .Net runtime uses to lower access. The fix for this is to open the properties dialog of the .zip file and next to the Security label, click "Unblock". Then, when you extract the files, they wont be restricted. Hopefully this helps.

     
  • Ryan Boggs
    Ryan Boggs
    2011-01-22

    I would like to hear from others who are experiencing these kinds of issues if brandonarp's suggestion works for them. I can't replicate the issue on any of my test boxes (xp & 7 32bit) but I do see the "Unblock" button in the properties for the zip file. However, it works for me whether the zip is blocked or not.

     

  • Anonymous
    2011-08-29

    Brandonarp' suggestion worked for me. Windows 7 x64.

     
  • Stefan Bodewig
    Stefan Bodewig
    2011-09-05

    I had the exact same problem as described in the bug report and the unblock solution described by bradonarp (that I discovered independently) worked for me.

     
  • Joe Masters
    Joe Masters
    2012-03-23

    Windows 7 x64 same issue, brandonarp's suggestion fixed it. Took way too long to find this solution.