473,233 Members | 1,448 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,233 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 6573
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: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

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.