Solved

PS 3 unexpected results shown on screen

Posted on 2013-12-26
2
247 Views
Last Modified: 2013-12-29
While my program is running (uses invoke-sql, export-csv) it periodically spits this information out to the console and I do not know what is causing it???

Module                     : CommonLanguageRuntimeLibrary
Assembly                   : mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
TypeHandle                 : System.RuntimeTypeHandle
DeclaringMethod            :
BaseType                   : System.Object
UnderlyingSystemType       : System.Exception
FullName                   : System.Exception
AssemblyQualifiedName      : System.Exception, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Namespace                  : System
GUID                       : a1c0a095-df97-3441-bfc1-c9f194e494db
IsEnum                     : False
GenericParameterAttributes :
IsSecurityCritical         : False
IsSecuritySafeCritical     : False
IsSecurityTransparent      : True
IsGenericTypeDefinition    : False
IsGenericParameter         : False
GenericParameterPosition   :
IsGenericType              : False
IsConstructedGenericType   : False
ContainsGenericParameters  : False
StructLayoutAttribute      : System.Runtime.InteropServices.StructLayoutAttribute
Name                       : Exception
MemberType                 : TypeInfo
DeclaringType              :
ReflectedType              :
MetadataToken              : 33554437
GenericTypeParameters      : {}
DeclaredConstructors       : {Void .ctor(), Void .ctor(System.String), Void .ctor(System.String, System.Exception), Void
                             .ctor(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)...}
DeclaredEvents             : {System.EventHandler`1[System.Runtime.Serialization.SafeSerializationEventArgs] SerializeObjectState}
DeclaredFields             : {_className, _exceptionMethod, _exceptionMethodString, _message...}
DeclaredMembers            : {System.String get_Message(), Void
                             add_SerializeObjectState(System.EventHandler`1[System.Runtime.Serialization.SafeSerializationEventArgs]), Void
                             remove_SerializeObjectState(System.EventHandler`1[System.Runtime.Serialization.SafeSerializationEventArgs]), System.Collections.IDictionary
                             get_Data()...}
DeclaredMethods            : {System.String get_Message(), Void
                             add_SerializeObjectState(System.EventHandler`1[System.Runtime.Serialization.SafeSerializationEventArgs]), Void
                             remove_SerializeObjectState(System.EventHandler`1[System.Runtime.Serialization.SafeSerializationEventArgs]), System.Collections.IDictionary
                             get_Data()...}
DeclaredNestedTypes        : {System.Exception+__RestrictedErrorObject, System.Exception+ExceptionMessageKind}
DeclaredProperties         : {System.String Message, System.Collections.IDictionary Data, System.Exception InnerException, System.Reflection.MethodBase TargetSite...}
ImplementedInterfaces      : {System.Runtime.Serialization.ISerializable, System.Runtime.InteropServices._Exception}
TypeInitializer            : Void .cctor()
IsNested                   : False
Attributes                 : AutoLayout, AnsiClass, Class, Public, Serializable, BeforeFieldInit
IsVisible                  : True
IsNotPublic                : False
IsPublic                   : True
IsNestedPublic             : False
IsNestedPrivate            : False
IsNestedFamily             : False
IsNestedAssembly           : False
IsNestedFamANDAssem        : False
IsNestedFamORAssem         : False
IsAutoLayout               : True
IsLayoutSequential         : False
IsExplicitLayout           : False
IsClass                    : True
IsInterface                : False
IsValueType                : False
IsAbstract                 : False
IsSealed                   : False
IsSpecialName              : False
IsImport                   : False
IsSerializable             : True
IsAnsiClass                : True
IsUnicodeClass             : False
IsAutoClass                : False
IsArray                    : False
IsByRef                    : False
IsPointer                  : False
IsPrimitive                : False
IsCOMObject                : False
HasElementType             : False
IsContextful               : False
IsMarshalByRef             : False
GenericTypeArguments       : {}
CustomAttributes           : {[System.SerializableAttribute()],
                             [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)0)],
                             [System.Runtime.InteropServices.ComDefaultInterfaceAttribute(typeof(System.Runtime.InteropServices._Exception))],
                             [System.Runtime.InteropServices.ComVisibleAttribute((Boolean)True)]...}
0
Comment
Question by:johnj_01201
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Author Comment

by:johnj_01201
ID: 39742482
This appears to have been caused by a line that reads:
$CSVRecord
which is inside a foreach($CSVRecord in $CSV) loop, and $CSV is the result of an invoke-sql statement.

It seems that sometimes the $CSVRecord is NULL and displays the above information, however I thought that was impossible seeing how I was in a foreach loop...
0
 
LVL 40

Accepted Solution

by:
footech earned 500 total points
ID: 39745238
however I thought that was impossible seeing how I was in a foreach loop
Not at all.  If $CSV is an array which includes elements that are null, then $CSVRecord will sometimes be null.
Best way around this is to filter or perform some validation of the results before they are stored in $CSV.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

"Migrate" an SMTP relay receive connector to a new server using info from an old server.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question