Hi,
I've hit quite a strange problem with XmlSerializer on my W2K3 server. When
I serialize/deserialize using an exe on my local computer (XP), everything
works fine. When I put the code out on the server (W2K3) it throws an
exception. It only seems to happen when serializing/deserializing _arrays_
of a type. If I just serialize/deserialize one instance, it works fine.
The exception I get is: (sorry for the word wrapping.)
System.InvalidOperationException: Unable to generate a temporary class
(result=1).
error CS1514: { expected
error CS1001: Identifier expected
error CS1031: Type expected
error CS1519: Invalid token '{' in class, struct, or interface member
declaration
error CS1514: { expected
error CS1001: Identifier expected
error CS1031: Type expected
error CS1519: Invalid token '{' in class, struct, or interface member
declaration
at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns,
CompilerParameters parameters, Evidence evidence)
at System.Xml.Serialization.TempAssembly.GenerateAsse mbly(XmlMapping[]
xmlMappings, Type[] types, String defaultNamespace, Evidence evidence,
CompilerParameters parameters, Assembly assembly, Hashtable assemblies)
at System.Xml.Serialization.TempAssembly..ctor(XmlMap ping[] xmlMappings,
Type[] types, String defaultNamespace, String location, Evidence evidence)
at System.Xml.Serialization.XmlSerializer.GenerateTem pAssembly(XmlMapping
xmlMapping, Type type, String defaultNamespace)
at System.Xml.Serialization.XmlSerializer..ctor(Type type, String
defaultNamespace)
at System.Xml.Serialization.XmlSerializer..ctor(Type type)
I have found people with similar problems and they have solved the issue by
granting permission to the Windows\temp directory to the IIS user. I have
granted permissions as needed, I believe. And I am reproducing this running
as an Admin on the box.
Any help would be appreciated. Anyone know how I can find out if it is a
permission issue? Does the XMLSerializer only create temporary classes for
arrays? Any other ideas? (It has to be an environmental issue with the
server, but I have no idea what.)
I have simplified the code down to this:
class Class1
{
[STAThread]
static void Main(string[] args)
{
try
{
TestIntegerArraySerialization();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
public static void TestIntegerArraySerialization()
{
XmlSerializer xs = new XmlSerializer(typeof(int[])); // <-- exception
thrown here on W2K3
int[] test = new int[1];
test[0] = 10;
System.IO.FileStream fs = new
System.IO.FileStream("out_integer.txt",System.IO.F ileMode.OpenOrCreate);
xs.Serialize(fs, test);
fs.Close();
}
} 3 3135
"token" always means, pay MICROSOFT.
----------------
Some realized that earlier around the Millenium.
----------------
To bad your were one of those that were busy filling SUVs.
=========
"Don McNamara" <don(dot)mcnamara(at)dovestar(dot)com> wrote in message
news:uI**************@TK2MSFTNGP10.phx.gbl... Hi,
I've hit quite a strange problem with XmlSerializer on my W2K3 server.
When I serialize/deserialize using an exe on my local computer (XP), everything works fine. When I put the code out on the server (W2K3) it throws an exception. It only seems to happen when serializing/deserializing _arrays_ of a type. If I just serialize/deserialize one instance, it works fine.
The exception I get is: (sorry for the word wrapping.) System.InvalidOperationException: Unable to generate a temporary class (result=1). error CS1514: { expected error CS1001: Identifier expected error CS1031: Type expected error CS1519: Invalid token '{' in class, struct, or interface member declaration error CS1514: { expected error CS1001: Identifier expected error CS1031: Type expected error CS1519: Invalid token '{' in class, struct, or interface member declaration
at System.Xml.Serialization.Compiler.Compile(Assembly parent, String
ns, CompilerParameters parameters, Evidence evidence) at System.Xml.Serialization.TempAssembly.GenerateAsse mbly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, CompilerParameters parameters, Assembly assembly, Hashtable assemblies) at System.Xml.Serialization.TempAssembly..ctor(XmlMap ping[]
xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence) at
System.Xml.Serialization.XmlSerializer.GenerateTem pAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace) at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace) at System.Xml.Serialization.XmlSerializer..ctor(Type type)
I have found people with similar problems and they have solved the issue
by granting permission to the Windows\temp directory to the IIS user. I have granted permissions as needed, I believe. And I am reproducing this
running as an Admin on the box.
Any help would be appreciated. Anyone know how I can find out if it is a permission issue? Does the XMLSerializer only create temporary classes for arrays? Any other ideas? (It has to be an environmental issue with the server, but I have no idea what.)
I have simplified the code down to this: class Class1 {
[STAThread] static void Main(string[] args) { try { TestIntegerArraySerialization(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public static void TestIntegerArraySerialization() { XmlSerializer xs = new XmlSerializer(typeof(int[])); // <-- exception thrown here on W2K3 int[] test = new int[1]; test[0] = 10; System.IO.FileStream fs = new System.IO.FileStream("out_integer.txt",System.IO.F ileMode.OpenOrCreate); xs.Serialize(fs, test); fs.Close(); } }
It is likely a permissions problem.
No, XML serializer does not only create temp files for arrays.
have you checked the xmlSerializerPreCompiler? (google it)
Please post when you have more info to share.
-D "Don McNamara" <don(dot)mcnamara(at)dovestar(dot)com> wrote in message news:uI**************@TK2MSFTNGP10.phx.gbl... Hi,
I've hit quite a strange problem with XmlSerializer on my W2K3 server. When I serialize/deserialize using an exe on my local computer (XP), everything works fine. When I put the code out on the server (W2K3) it throws an exception. It only seems to happen when serializing/deserializing _arrays_ of a type. If I just serialize/deserialize one instance, it works fine.
The exception I get is: (sorry for the word wrapping.) System.InvalidOperationException: Unable to generate a temporary class (result=1). error CS1514: { expected error CS1001: Identifier expected error CS1031: Type expected error CS1519: Invalid token '{' in class, struct, or interface member declaration error CS1514: { expected error CS1001: Identifier expected error CS1031: Type expected error CS1519: Invalid token '{' in class, struct, or interface member declaration
at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, CompilerParameters parameters, Evidence evidence) at System.Xml.Serialization.TempAssembly.GenerateAsse mbly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, CompilerParameters parameters, Assembly assembly, Hashtable assemblies) at System.Xml.Serialization.TempAssembly..ctor(XmlMap ping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence) at System.Xml.Serialization.XmlSerializer.GenerateTem pAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace) at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace) at System.Xml.Serialization.XmlSerializer..ctor(Type type)
I have found people with similar problems and they have solved the issue by granting permission to the Windows\temp directory to the IIS user. I have granted permissions as needed, I believe. And I am reproducing this running as an Admin on the box.
Any help would be appreciated. Anyone know how I can find out if it is a permission issue? Does the XMLSerializer only create temporary classes for arrays? Any other ideas? (It has to be an environmental issue with the server, but I have no idea what.)
I have simplified the code down to this: class Class1 {
[STAThread] static void Main(string[] args) { try { TestIntegerArraySerialization(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public static void TestIntegerArraySerialization() { XmlSerializer xs = new XmlSerializer(typeof(int[])); // <-- exception thrown here on W2K3 int[] test = new int[1]; test[0] = 10; System.IO.FileStream fs = new System.IO.FileStream("out_integer.txt",System.IO.F ileMode.OpenOrCreate); xs.Serialize(fs, test); fs.Close(); } }
Thanks Dino.
I looked at the XmlSerializerPreCompile, it takes a type. Any idea how to
pass it an array of a type?
(Just FYI, as a short term fix we rewrote our code and are manually
deserializing the data...)
Don
"Dino Chiesa [Microsoft]" <di****@online.microsoft.com> wrote in message
news:ea**************@tk2msftngp13.phx.gbl... It is likely a permissions problem. No, XML serializer does not only create temp files for arrays. have you checked the xmlSerializerPreCompiler? (google it)
Please post when you have more info to share. -D
"Don McNamara" <don(dot)mcnamara(at)dovestar(dot)com> wrote in message news:uI**************@TK2MSFTNGP10.phx.gbl... Hi,
I've hit quite a strange problem with XmlSerializer on my W2K3 server. When I serialize/deserialize using an exe on my local computer (XP), everything works fine. When I put the code out on the server (W2K3) it throws an exception. It only seems to happen when serializing/deserializing _arrays_ of a type. If I just serialize/deserialize one instance, it works fine.
The exception I get is: (sorry for the word wrapping.) System.InvalidOperationException: Unable to generate a temporary class (result=1). error CS1514: { expected error CS1001: Identifier expected error CS1031: Type expected error CS1519: Invalid token '{' in class, struct, or interface member declaration error CS1514: { expected error CS1001: Identifier expected error CS1031: Type expected error CS1519: Invalid token '{' in class, struct, or interface member declaration
at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, CompilerParameters parameters, Evidence evidence) at
System.Xml.Serialization.TempAssembly.GenerateAsse mbly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, CompilerParameters parameters, Assembly assembly, Hashtable assemblies) at System.Xml.Serialization.TempAssembly..ctor(XmlMap ping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence) at System.Xml.Serialization.XmlSerializer.GenerateTem pAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace) at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace) at System.Xml.Serialization.XmlSerializer..ctor(Type type)
I have found people with similar problems and they have solved the
issue by granting permission to the Windows\temp directory to the IIS user. I
have granted permissions as needed, I believe. And I am reproducing this running as an Admin on the box.
Any help would be appreciated. Anyone know how I can find out if it is
a permission issue? Does the XMLSerializer only create temporary classes for arrays? Any other ideas? (It has to be an environmental issue with the server, but I have no idea what.)
I have simplified the code down to this: class Class1 {
[STAThread] static void Main(string[] args) { try { TestIntegerArraySerialization(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public static void TestIntegerArraySerialization() { XmlSerializer xs = new XmlSerializer(typeof(int[])); // <-- exception thrown here on W2K3 int[] test = new int[1]; test[0] = 10; System.IO.FileStream fs = new
System.IO.FileStream("out_integer.txt",System.IO.F ileMode.OpenOrCreate); xs.Serialize(fs, test); fs.Close(); } }
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Harris Boyce |
last post by:
Hello,
I'm trying to use the FOR XML EXPLICIT clause with SQL
Server to deserialize data from my database into a
strongly-typed collection object that I will use
throughout my application. I...
|
by: Chris Aitchison |
last post by:
Hello,
I am attempting to have a class that I have written serialize so that it can
be both passed as a parameter or return value for a webservice, and also be
serialized to disk using the...
|
by: Anthony Bouch |
last post by:
Hi
I've been reading using the XmlSerializer with custom collections.
I've discovered that when serializing a custom collection (a class that
implements ICollection, IList etc.) the...
|
by: Andy Neilson |
last post by:
I've run across a strange behaviour with XmlSerializer that I'm unable to explain. I came across this while trying to use XmlSerializer to deserialize from a the details of a SoapException. This...
|
by: Bob Rock |
last post by:
Hello,
when serializing an array of elements of a class Classname using
XmlSerializer.Serialize() I get an XML like the following:
<?xml version="1.0">
<ArrayOfClassname>
.......
..........
|
by: Jamus Sprinson |
last post by:
Before I continue, I'm going to begin by saying I'm not by any means
an expert- I've been using .NET with C# for about 4 months now, and
basically just learning by example and docs.
A game...
|
by: BuddyWork |
last post by:
Hello,
When running the following line of code
XmlSerializer serializer = new XmlSerializer(typeof
(MyXmlTestClass));
I get the following exception message.
An unhandled exception of
|
by: Chukkalove |
last post by:
I'm sorry this message is so long.
I have had to make some changes to an application written by a previous
developer who used unmanaged serialization to store complex objects to file.
The...
|
by: theonlydavewilliams |
last post by:
Hi there
I'm hoping there's an easy answer to a (hopefully) not too long-winded issue...
I'm building a C# web client using a proxy wsdl.exe'd from a wsdl file and six schemas, each in a different...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |