Hello,
a few users of one of our customers currently experience the following issue when our program calls Infragistics.Win.UltraWinGrid.UltraGridLayout.LoadFromXml(Stream stream, PropertyCategories propertyCategories).
The stream is a memory stream and propertyCategories is set to PropertyCategories.All.
This results in a System.Reflection.TargetInvocationException.
The strange thing about this is, that no matter the source of the XML (in this case it is actually created in memory and loaded from anywhere) this fails. I have compared the XML with the XML on a machine where it worked and did not find any significant differences.
This issue on comes up on very few specific computers and not anywhere else.
We have checked the GAC and the folder our software has been deployed in and there are no anomalies either.
The users culture is US English.
Has anybody else experienced a similar error?
Here is the call stack
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at Infragistics.Win.UltraWinGrid.SortedColumnsCollection..ctor(SerializationInfo info, StreamingContext context)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._SerializationInvoke(Object target, SignatureStruct& declaringTypeSig, SerializationInfo info, StreamingContext context)
at System.RuntimeMethodHandle.SerializationInvoke(Object target, SignatureStruct declaringTypeSig, SerializationInfo info, StreamingContext context)
at System.Reflection.RuntimeConstructorInfo.SerializationInvoke(Object target, SerializationInfo info, StreamingContext context)
at System.Runtime.Serialization.ObjectManager.CompleteISerializableObject(Object obj, SerializationInfo info, StreamingContext context)
at System.Runtime.Serialization.ObjectManager.FixupSpecialObject(ObjectHolder holder)
at System.Runtime.Serialization.ObjectManager.DoFixups()
at System.Runtime.Serialization.Formatters.Soap.ObjectReader.Deserialize(HeaderHandler handler, ISerParser serParser)
at System.Runtime.Serialization.Formatters.Soap.SoapFormatter.Deserialize(Stream serializationStream, HeaderHandler handler)
at System.Runtime.Serialization.Formatters.Soap.SoapFormatter.Deserialize(Stream serializationStream)
at Infragistics.Win.UltraWinGrid.UltraGridLayout.LoadHelper(Stream stream, PropertyCategories propertyCategories, IFormatter formatter)
at Infragistics.Win.UltraWinGrid.UltraGridLayout.LoadFromXml(Stream stream, PropertyCategories propertyCategories)
Best regards
Sebastian PeschtiesLogimatic Germany GmbH
Hi,
Okay, that solves the mystery - you are using an Encoder. I discussed this in some detail (and provided sample code to do this correctly) here:
Convert String to Stream correctly for DisplayLayout.Load() - Infragistics Community
Hi Mike,
The code i am using is working in one grid and is not working for one of the other grid in my project.
Is there any property or setting of column/bands or datatype of column which may result in this exception ?
Datatype of column include all Int64,Int32,Double,DateTime,String
I am just saving the layout to this stream and nothing else.Below is the code I am using to Load and Save the Layout.
I am saving Layout to an XML and the saving it in database
myGrid.DisplayLayout.SaveAsXml(fileName, PropertyCategories.All);
Then at load i am deserializing it to stream
string
App.SystemSerializer.DeserializeDefaults(sessionType, out
defXml);
MemoryStream strLayout = new MemoryStream(byteArray);
if (strLayout != null)
{
uGrdResults.DisplayLayout.LoadFromXml(strLayout);
strLayout.Close();
}
Please let me know if anything wrong is there.
I will work on a project to replicate this issue.
Thanks for reply any help is much appreciated.
Can you reproduce this issue in a small sample project?
Was this code working at some point and now it's not? Or has it never worked?
Are you saving anything else to this stream beside the grid layout? Can you post the code you are using to save the layout to the stream?
What are the data types of the columns in your grid?
Here is the stack trace of exception i am getting :
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Inner exception: Object reference not set to an instance of an object.
at Infragistics.Win.UltraWinGrid.UltraGridLayout.LoadFromXml(Stream stream)
Checked GAC For multiple assemblies not found any.
Hi ,
I am facing the same issue in v10.2.
can anyone help me with how to solve this issue ?