exeption LIST<T>

Jun 9, 2010 at 1:18 PM

Hi together

following Problem:

I create this class

 public class test {
        public string Spalte1 { get; set; }
        public string Spalte2 { get; set; }
        public string Spalte3 { get; set; }
        public string Spalte4 { get; set; }
        public string Spalte5 { get; set; }
    }

 

then i make a List<test>

i fill the List with some Data and try to make for ex. an Excel sheet.

Then i get an Exception.

I thought thet "IEnumerable of same objects" is possible ?

can you give me an example what kind of Ienamberable would work ?

 

Thanks

Klaus

Jun 9, 2010 at 2:31 PM

what exception do you get?

Jun 9, 2010 at 3:54 PM

Hi ;

The Exeption raises at :

public static INode CreateExporter(object oLoop, string NameProp, string DefaultID)

{

//(T o,string NameProp, string DefaultID)

string t = "ST_Exporter.ST_Node" + "`1";

Type generic = Type.GetType(t).MakeGenericType(oLoop.GetType());

return Activator.CreateInstance(generic, oLoop, NameProp, DefaultID) as INode;

}

And this is the Message:

System.NullReferenceException wurde nicht behandelt.

Message=Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.

Source=ExportHierarchical

StackTrace:

bei ExportHierarchical.GenReflectNode.CreateExporter(Object oLoop, String NameProp, String DefaultID) in ST_Hash.cs:Zeile 646.

bei ExportDLL.ExportTo.CollectionRenderProperties.Node(IEnumerable col, Type type, List`1 properties) in ExportTo.cs:Zeile 249.

bei ExportDLL.ExportTo.CollectionRenderProperties.Template2String(IEnumerable col, Type type, List`1 properties, ExportToFormat exp) in ExportTo.cs:Zeile 475.

bei ExportDLL.ExportTo.CollectionRenderProperties.ExportTo(IEnumerable col, Type type, List`1 properties, ExportToFormat exp, String FileName) in ExportTo.cs:Zeile 375.

bei ExportDLL.ExportTo.CollectionRenderProperties.ExportTo(IEnumerable col, Type type, ExportToFormat exp, String FileName) in ExportTo.cs:Zeile 190.

bei ExportDLL.ExportTo.CollectionRenderProperties.ExportTo[T](IEnumerable`1 col, ExportToFormat exp, String FileName) in ExportTo.cs:Zeile 159.

bei ExportDemo.Program.Main(String[] args) in Program.cs:Zeile 95.

bei System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)

bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)

bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

bei System.Threading.ThreadHelper.ThreadStart()

InnerException:

Best wishes and Thanks

$B!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!(B ( Klaus Rumold )

Jun 9, 2010 at 10:06 PM
please send me the project at ignatandrei at yahoo dot com Thank you,
Feb 7, 2011 at 5:02 AM

Changing code in ST_Hash.cs as described below worked for me

string t = "ST_Exporter.ST_Node" + "`1"

to

string t = "www.serviciipeweb.ro.iafblog.ExportHierarchical.ST_Node" + "`1"

Hope that helps.

Chaitanya

 

Feb 22, 2011 at 7:26 AM

i wrote in vb.net and found error :

  Dim pro As New HLTPRO
  Dim lpro As New List(Of HLTPRO)
  lpro = pro.SelectDataExpireTermination()
  lpro.ExportTo(www.serviciipeweb.ro.iafblog.ExportDLL.ExportToFormat.Excel2003XML, "C:\cc.xls")

 error : Object reference not set to an instance of an object.