473,385 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Timeout during XmlSerializer instantiation

I am instantiating an XmlSerializer using the XmlSerializer(Type)
constructor. This works most of the time, but sometimes I get a timeout
during the process. I'm using the same type in all cases and it has happened
on multiple computers ranging from 500 MHz to 2.6 GHz. Does anyone know why
the csc.exe process would time out in this case? It looks like the timeout
is set to 10 minutes which seems like a long time to wait for something.

Here's the detailed stack trace if it helps:

Timed out waiting for a program to execute. The command being executed was
"c:\winnt\microsoft.net\framework\v1.1.4322\csc.ex e" /noconfig
@"C:\TEMP\qwjndcv1.cmdline".
at
System.CodeDom.Compiler.Executor.ExecWaitWithCaptu reUnimpersonated(IntPtr
userToken, String cmd, String currentDir, TempFileCollection tempFiles,
String& outputName, String& errorName, String trueCmdLine)
at System.CodeDom.Compiler.Executor.ExecWaitWithCaptu re(IntPtr userToken,
String cmd, String currentDir, TempFileCollection tempFiles, String&
outputName, String& errorName, String trueCmdLine)
at System.CodeDom.Compiler.CodeCompiler.Compile(Compi lerParameters
options, String compilerDirectory, String compilerExe, String arguments,
String& outputFile, Int32& nativeReturnValue, String trueArgs)
at System.CodeDom.Compiler.CodeCompiler.FromFileBatch (CompilerParameters
options, String[] fileNames)
at
System.CodeDom.Compiler.CodeCompiler.FromSourceBat ch(CompilerParameters
options, String[] sources)
at System.CodeDom.Compiler.CodeCompiler.FromSource(Co mpilerParameters
options, String source)
at
System.CodeDom.Compiler.CodeCompiler.System.CodeDo m.Compiler.ICodeCompiler.C
ompileAssemblyFromSource(CompilerParameters options, String source)
at System.Xml.Serialization.Compiler.Compile()
at System.Xml.Serialization.TempAssembly..ctor(XmlMap ping[] xmlMappings)
at System.Xml.Serialization.XmlSerializer..ctor(Type type, String
defaultNamespace)
at System.Xml.Serialization.XmlSerializer..ctor(Type type)

Thanks,
Rangi
Nov 12 '05 #1
11 6587
Hi Rangi,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you got an exception occasionally
during an XmlSerialization. If there is any misunderstanding, please feel
free to let me know.

Based on my research, this might have something to do with the anti-virus
software on your machine. I think that the anti-virus software is locking
the file in non shared mode and c# compiler not able to access it.
Excluding C# files from the anti virus might fix the problem.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #2
Your understanding is correct. The timeout happens only occasionally (less
than 1% of the time). It seems to be happening when the user closes the main
application window rather than using the File -> Exit command. In this case,
the XmlSerializer is created during the OnClosing method of the main form
window. I have not seen this error any other time, although I know it is
called from three other places in the code with roughly the same frequency
this would be. I don't know how the users are closing the main application
window (using the X button, logging out of Windows, right clicking it in the
task bar, etc.). Could one of these methods cause this timeout more often
than any of the other methods?

We have also been seeing another issue during the same XmlSerializer
initialization. This one is a WinIOError and I have also only seen this
during the call to OnClosing (not any of the other places it is called
from). This one appears to happen somewhat more frequently than the timeout
(probably around 1-2% of the time). Could this be a related issue?

Here's the complete error and stack trace:

Could not find file "C:\Temp\nslcxwiy.dll".
at System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath,
Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share)
at System.CodeDom.Compiler.CodeCompiler.FromFileBatch (CompilerParameters
options, String[] fileNames)
at
System.CodeDom.Compiler.CodeCompiler.FromSourceBat ch(CompilerParameters
options, String[] sources)
at System.CodeDom.Compiler.CodeCompiler.FromSource(Co mpilerParameters
options, String source)
at
System.CodeDom.Compiler.CodeCompiler.System.CodeDo m.Compiler.ICodeCompiler.C
ompileAssemblyFromSource(CompilerParameters options, String source)
at System.Xml.Serialization.Compiler.Compile()
at System.Xml.Serialization.TempAssembly..ctor(XmlMap ping[] xmlMappings)
at System.Xml.Serialization.XmlSerializer..ctor(Type type, String
defaultNamespace)
at System.Xml.Serialization.XmlSerializer..ctor(Type type)
...
at <Application>.MainForm.OnClosing(CancelEventArgs e)
...

We do have Symantec AntiVirus software installed on all our computers and it
does do realtime file checking. Could this be causing a 10 minute timeout of
the C# compiler during the ExecWaitWithCaptureUnimpersonated method? I would
think a locked or inaccessible file would cause an immediate error.

Thanks,
Rangi

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:s$***************@cpmsftngxa10.phx.gbl...
Hi Rangi,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you got an exception occasionally
during an XmlSerialization. If there is any misunderstanding, please feel
free to let me know.

Based on my research, this might have something to do with the anti-virus
software on your machine. I think that the anti-virus software is locking
the file in non shared mode and c# compiler not able to access it.
Excluding C# files from the anti virus might fix the problem.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #3
Hi Rangi,

I think it might have something to do with the AntiVirus software. Because
there were precedents with similar stack trace that make timeout happen.

Could you try to run this on a machine without the Antivirus software to
see if it occurs again?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #4
I don't think this is caused by anti-virus software. As I mentioned in my
previous post, we call this same code from multiple places in the
application and the only time it fails is when the application is being
closed by closing the main (MDI) window. This may be initiated by the user
clicking the X button or by logging out of Windows (among other
possibilities).

Since it happens so infrequently, we'd have to turn off the anti-virus
software for all our computers to verify that it is not happening. This
course of action will not be acceptable to the company without a clear a
verified reason to do so. I'm sure they wouldn't do it just to test a
theory.

Please let me know if you have any other thoughts on the matter.

Thank you,
Rangi Keen

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:G2**************@cpmsftngxa10.phx.gbl...
Hi Rangi,

I think it might have something to do with the AntiVirus software. Because
there were precedents with similar stack trace that make timeout happen.

Could you try to run this on a machine without the Antivirus software to
see if it occurs again?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #5
Hi Rangi,

Some anti-virus software are still monitoring, even you have turned off
from user interface, and the monitoring process is still running. The best
way to test it is to uninstall the anti-virus software and test it on a
clean machine. If you are having concern to uninstall, you can also try it
in Safe Mode. However, I'm not quite sure if some specific anti-virus
software will not loaded in safe mode. HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #6
I should have mentioned that I did test the sample I sent on a clean machine
with no Anti-Virus software installed (it has never been installed on this
test computer) and was still able to reproduce the same problem. I think
this points to an issue other than Anit-Virus software.

Rangi

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:%2****************@cpmsftngxa10.phx.gbl...
Hi Rangi,

Some anti-virus software are still monitoring, even you have turned off
from user interface, and the monitoring process is still running. The best
way to test it is to uninstall the anti-virus software and test it on a
clean machine. If you are having concern to uninstall, you can also try it
in Safe Mode. However, I'm not quite sure if some specific anti-virus
software will not loaded in safe mode. HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #7
Hi Rangi,

We have reviewed this issue and are currently researching on it. We will
update you ASAP. Thanks for your patience!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #8
Hi Rangi,

Thanks for your repro code and steps. I have successfully reproduced it on
my machine. I have forwarded it to our developer team. They are currently
working on this issue and trying to find a workaround for you. I will
update you as soon as I get any response from them. Thanks for your
patience!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #9
Hi Rangi,

This is expected behavior. Since the system was shutting down, new
processes (csc.exe) could not be created because some DLLs would fail to
initialize at this time.

From the callstack the csc.exe was created when you instantiate the
XmlSerializer object, so a workaround is to instantiate it prior to
Form_closing, as below:

Dim oSerializer As New Serialization.XmlSerializer(GetType(DateTime))

Private Sub Form1_Closing(¡*)
oSerializer.Serialize(System.IO.File.Create("C:\Te st.xml"),
DateTime.Now)
End Sub

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #10
Thanks. I did end up doing this and I believe it will fix the problem. I
didn't find any mention of this as a potential issue in the MSDN library
documentation. It might be worth adding a note in the remarks of the
constructor documentation to this effect so other people don't run into this
issue.

Thanks again for you help on this issue.

Rangi

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:UF**************@cpmsftngxa10.phx.gbl...
Hi Rangi,

This is expected behavior. Since the system was shutting down, new
processes (csc.exe) could not be created because some DLLs would fail to
initialize at this time.

From the callstack the csc.exe was created when you instantiate the
XmlSerializer object, so a workaround is to instantiate it prior to
Form_closing, as below:

Dim oSerializer As New Serialization.XmlSerializer(GetType(DateTime))

Private Sub Form1_Closing(¡*)
oSerializer.Serialize(System.IO.File.Create("C:\Te st.xml"),
DateTime.Now)
End Sub

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #11
Hi Rangi,

Thanks for your feedback. I will forward this to the corresponding team.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: tonci.tomic | last post by:
I have windows service running on win2000 and client applications on local network connected to service via remoting. Service acts as interface to MSSQL 2000 database and it uses Microsoft Data...
0
by: Craig Schneider | last post by:
// Is there any way to override the XML Serialization of the following SimpleClass // to turn off the DefaultValue of a boolean? Sure, I can override the DefaultValue from // true to false, but...
2
by: Gary Brewer | last post by:
Below are my classes generated using XSD.EXE from XML/XSLT When I do XmlSerializer xmls=new XmlSerializer(typeof(events)); I get
4
by: Steve Long | last post by:
Hello, I hope this is the right group to post this to. I'm trying to serialize a class I've written and I'd like to be able to serialze to both binary and xml formats. Binary serialization is...
5
by: Jason | last post by:
Hi all I get the following error when executing a rather intense stored procedure from an ASPX page. I have tried: - Increasing timeouts on IIS 5.0 (all areas that even mention timeout) - use...
3
by: Jeff Carver | last post by:
I'm creating a class (using VB.NET) that must read data from a database table during instantiation. If the data cannot be read (connection problem, etc.), I want the instantiation to fail such...
3
by: Nils Magnus Englund | last post by:
Hi, I've made a HttpModule which deals with user authentication. On the first request in a users session, it fetches data from a SQL Server using the following code: using (SqlConnection...
0
by: awood45 | last post by:
I ran into a bizarre crashing of one of my programs earlier today, and noticed my IE 6 was messed up (maybe this is important, maybe it isn't, but it coincided with this not working). After fixing...
1
by: John Richard | last post by:
We have used the session to get redirect the page when the session is timeout. But unfortunately, it is not fine. We have many steps to use to solve this problem but not set. It stands only upon 10...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
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...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.