Extensions throw exception when used with Nsoftware's NetCmdlets

Topics: Developer Forum, User Forum
Jul 24, 2007 at 8:22 PM
When loading the NetCmdlets ConsoleFile which is:

<PSConsoleFile ConsoleSchemaVersion="1.0">
<PSSnapIn Name="NetCmdlets"/>

the following exception is thrown...

Microsoft Windows XP Version 5.1.2600

(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\administrator>C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile "
E:\Program Files\nsoftware\NetCmdlets\nsoftware.NetCmdlets.Commands.psc1"
Windows PowerShell
Copyright (C) 2006 Microsoft Corporation. All rights reserved.

An error has occurred that was not properly handled. Additional information is shown below. The Windows PowerShell
process will exit.

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at Pscx.Commands.TabExpansion.Caches.TypeNameCache.Node.Add(Type type)
at Pscx.Commands.TabExpansion.Caches.TypeNameCache.OnInitialize()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode ba
ckoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, O
bject state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object st
at System.Threading.ThreadHelper.ThreadStart()

C:\Documents and Settings\administrator>
Jul 24, 2007 at 8:40 PM
Ok, threw it into Debug it looks like they did not put a namepace in their assembly (they meaning nsoftware)

AssemblyQualifiedName "aan, nsoftware.NetCmdlets.Commands, Version=1.0.2755.0, Culture=neutral, PublicKeyToken=cdc168f89cffe9cf" string

In TypeNameCache.cs line #158 string[] ns = type.Namespace.Split('.') throws a null reference exception because the type being passed in does not have a namespace.

If the type does not have a namespace, then it should not be added...
Jul 26, 2007 at 6:30 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jul 26, 2007 at 6:31 AM
Craig, thanks for letting us know about this issue.