Topaz Filer: if you use e-mail for business, we can save you money and decrease your risk.
XmlSerializer error on instantiation.
Messages   Related Types
This message was discovered on microsoft.public.dotnet.xml.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Ryan
I'm trying to serialize a simple class. I'm following the code on
MSDN Magazine Feb 2003 pg. 27. My class (TestClass) has 1 property (a
string). I make the following call:

XmlSerializer ser = new XmlSerializer(typeof(TestClass));

I'm in a webapp. I get the following error:

File or assembly name zmp0husw.dll, or one of its dependencies, was
not found.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: File or assembly
name zmp0husw.dll, or one of its dependencies, was not found.

Source Error:

Line 310://                XmlSerializer ser = new
XmlSerializer(typeof(Report.GenericReport));
Line 311:                Type t = typeof(TestClass);
Line 312:                XmlSerializer ser = new XmlSerializer(typeof(TestClass));
Line 313:                TestClass testClass = new TestClass();
Line 314:                testClass.Name = "blah";

Source File: c:\inetpub\wwwroot\mos_1_2\commoncontrols\ucreport.ascx.cs
Line: 312

Assembly Load Trace: The following information can be helpful to
determine why the assembly 'zmp0husw.dll' could not be loaded.

=== Pre-bind state information ===
LOG: Where-ref bind. Location = C:\WINDOWS\TEMP\zmp0husw.dll
LOG: Appbase = file:///c:/inetpub/wwwroot/Mos_1_2
LOG: Initial PrivatePath = bin
Calling assembly : (Unknown).
===

LOG: Policy not being applied to reference at this time (private,
custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL
file:///C:/WINDOWS/TEMP/zmp0husw.dll.

Stack Trace:

[FileNotFoundException: File or assembly name zmp0husw.dll, or one of
its dependencies, was not found.]
System.Reflection.Assembly.nLoad(AssemblyName fileName, String
codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean
throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark)
+0
System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,
Boolean stringized, Evidence assemblySecurity, StackCrawlMark&
stackMark) +307
System.Reflection.Assembly.Load(AssemblyName assemblyRef) +22
System.CodeDom.Compiler.CompilerResults.get_CompiledAssembly() +64
System.Xml.Serialization.Compiler.Compile()
System.Xml.Serialization.TempAssembly..ctor(XmlMapping[]
xmlMappings)
System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlTypeMapping
xmlTypeMapping)
System.Xml.Serialization.XmlSerializer..ctor(Type type)
Mos.CommonControls.UCReport.LoadReport(String strReportMoniker,
Boolean bFromSession) in
c:\inetpub\wwwroot\mos_1_2\commoncontrols\ucreport.ascx.cs:312
Mos.MarketingPerformanceMonitor.Reports.Page_Load(Object sender,
EventArgs e) in c:\inetpub\wwwroot\Mos_1_2\MarketingPerformanceMonitor\Reports.aspx.cs:148
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +29
System.Web.UI.Page.ProcessRequestMain() +724

Ryan Grimard
Reply to this message...
Vote that this is a GOOD answer...
 
Auto-following on Twitter
Ubuntu and XP on one “desktop”
 
    
Christoph Schittko (VIP)
Ryan,

It's a bug ... The XmlSerializer is compiling temporary assemblies when
you instantiate it. This requires access to the Windows\Temp directory, but
the account under which ASP.NET is running by default (ASPNET) does not have
write permissions there. One way you can work around this is making this
directory writable for the ASPNET account. Let me know if this doesn't work
in your scenario.

HTH,
--
Christoph Schittko
Software Architect, .NET Mentor

"Ryan" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Ryan
Christoph,
I tried this in a Windows Application and I got the same error. I
also made the Windows\Temp directory recursively read-write and gave
full control to "Everyone". No luck there either...

Any other ideas?

Ryan Grimard

"Christoph Schittko" <Click here to reveal e-mail address> wrote in message news:<eEMQ$WoxCHA.2660@TK2MSFTNGP09>...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Bill Cheng [MSFT]
Hi Ryan,

I understand that the problem occurs with Windows Application. Please make
sure you have logged on the machine using an administrative account. In
addition, you have granted "Read/Write" rights to Everyone for
"Windows\Temp" directory. Since the application has enough security
permissions, we may need to check other areas.

From your first post, I assume that TestClass is a simple class and has
only one string-type member. Sometimes I see errors occur for creating
serializer for complex classes. However, this should not be the problem in
this issue.

According to my research, the problem may be caused by corrupted
installation of .NET Framework. Could you uninstall the current version of
the .NET Framework and re-install the .NET Framework to the machine? You
may backup important files first. To remove .NET Framework, refer to the
following article:
320112.KB.EN-US PRB: Installation of .NET Framework Fails and Requires
Manual Remo
http://support.microsoft.com/default.aspx?scid=KB;EN-US;320112

320114.KB.EN-US HOW TO: Remove Visual Studio .NET Components Manua
http://support.microsoft.com/default.aspx?scid=KB;EN-US;320114

Feel free to keep me updated with the progress on your side.

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

Regards,

Bill Cheng
Microsoft Support Engineer
--------------------
| From: Click here to reveal e-mail address (Ryan)
| Subject: Re: XmlSerializer error on instantiation.
| Date: 28 Jan 2003 05:51:46 -0800
| Organization: http://groups.google.com/
| Lines: 108
| Message-ID: <Click here to reveal e-mail address>
| References: <Click here to reveal e-mail address>
<eEMQ$WoxCHA.2660@TK2MSFTNGP09>
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Complaints-To: Click here to reveal e-mail address
| NNTP-Posting-Date: 28 Jan 2003 13:51:46 GMT
| Newsgroups: microsoft.public.dotnet.xml
| NNTP-Posting-Host: vienna7.his.com 216.194.225.92
| Path:
cpmsftngxa06!TK2MSFTNGP08!TK2MSFTNGP09!vienna7.his.com!news.lightlink.com!pr
iapus.visi.com!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!sn-xit
-03!sn-xit-01!sn-xit-09!sn-xit-08!supernews.com!postnews1.google.com!not-for
-mail
| Xref: cpmsftngxa06 microsoft.public.dotnet.xml:10814
| X-Tomcat-NG: microsoft.public.dotnet.xml
|
| Christoph,
| I tried this in a Windows Application and I got the same error. I
| also made the Windows\Temp directory recursively read-write and gave
| full control to "Everyone". No luck there either...
|
| Any other ideas?
|
| Ryan Grimard
|
| "Christoph Schittko" <Click here to reveal e-mail address> wrote in
message news:<eEMQ$WoxCHA.2660@TK2MSFTNGP09>...
| > Ryan,
| >
| > It's a bug ... The XmlSerializer is compiling temporary assemblies
when
| > you instantiate it. This requires access to the Windows\Temp directory,
but
| > the account under which ASP.NET is running by default (ASPNET) does not
have
| > write permissions there. One way you can work around this is making this
| > directory writable for the ASPNET account. Let me know if this doesn't
work
| > in your scenario.
| >
| > HTH,
| > --
| > Christoph Schittko
| > Software Architect, .NET Mentor
| >
| > "Ryan" <Click here to reveal e-mail address> wrote in message
| > news:Click here to reveal e-mail address...
| > > I'm trying to serialize a simple class. I'm following the code on
| > > MSDN Magazine Feb 2003 pg. 27. My class (TestClass) has 1 property (a
| > > string). I make the following call:
| > >
| > > XmlSerializer ser = new XmlSerializer(typeof(TestClass));
| > >
| > > I'm in a webapp. I get the following error:
| > >
| > > File or assembly name zmp0husw.dll, or one of its dependencies, was
| > > not found.
| > > Description: An unhandled exception occurred during the execution of
| > > the current web request. Please review the stack trace for more
| > > information about the error and where it originated in the code.
| > >
| > > Exception Details: System.IO.FileNotFoundException: File or assembly
| > > name zmp0husw.dll, or one of its dependencies, was not found.
| > >
| > > Source Error:
| > >
| > >
| > > Line 310:// XmlSerializer ser = new
| > > XmlSerializer(typeof(Report.GenericReport));
| > > Line 311: Type t = typeof(TestClass);
| > > Line 312: XmlSerializer ser = new XmlSerializer(typeof(TestClass));
| > > Line 313: TestClass testClass = new TestClass();
| > > Line 314: testClass.Name = "blah";
| > >
| > >
| > > Source File:
c:\inetpub\wwwroot\mos_1_2\commoncontrols\ucreport.ascx.cs
| > > Line: 312
| > >
| > > Assembly Load Trace: The following information can be helpful to
| > > determine why the assembly 'zmp0husw.dll' could not be loaded.
| > >
| > >
| > > === Pre-bind state information ===
| > > LOG: Where-ref bind. Location = C:\WINDOWS\TEMP\zmp0husw.dll
| > > LOG: Appbase = file:///c:/inetpub/wwwroot/Mos_1_2
| > > LOG: Initial PrivatePath = bin
| > > Calling assembly : (Unknown).
| > > ===
| > >
| > > LOG: Policy not being applied to reference at this time (private,
| > > custom, partial, or location-based assembly bind).
| > > LOG: Attempting download of new URL
| > > file:///C:/WINDOWS/TEMP/zmp0husw.dll.
| > >
| > >
| > >
| > > Stack Trace:
| > >
| > >
| > > [FileNotFoundException: File or assembly name zmp0husw.dll, or one of
| > > its dependencies, was not found.]
| > > System.Reflection.Assembly.nLoad(AssemblyName fileName, String
| > > codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean
| > > throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark)
| > > +0
| > > System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,
| > > Boolean stringized, Evidence assemblySecurity, StackCrawlMark&
| > > stackMark) +307
| > > System.Reflection.Assembly.Load(AssemblyName assemblyRef) +22
| > > System.CodeDom.Compiler.CompilerResults.get_CompiledAssembly() +64
| > > System.Xml.Serialization.Compiler.Compile()
| > > System.Xml.Serialization.TempAssembly..ctor(XmlMapping[]
| > > xmlMappings)
| > >
| >
System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlTypeMapping
| > > xmlTypeMapping)
| > > System.Xml.Serialization.XmlSerializer..ctor(Type type)
| > > Mos.CommonControls.UCReport.LoadReport(String strReportMoniker,
| > > Boolean bFromSession) in
| > > c:\inetpub\wwwroot\mos_1_2\commoncontrols\ucreport.ascx.cs:312
| > > Mos.MarketingPerformanceMonitor.Reports.Page_Load(Object sender,
| > > EventArgs e) in
| >
c:\inetpub\wwwroot\Mos_1_2\MarketingPerformanceMonitor\Reports.aspx.cs:148
| > > System.Web.UI.Control.OnLoad(EventArgs e) +67
| > > System.Web.UI.Control.LoadRecursive() +29
| > > System.Web.UI.Page.ProcessRequestMain() +724
| > >
| > >
| > > Ryan Grimard
|

Reply to this message...
Vote that this is a GOOD answer...
 
Outlook interop - stopping user properties appearing on Outlook message print
Seriously, why is “cut and paste” majorly newsworthy???
 
    
Ryan Grimard
Bill, thank you for your prompt response. Your assumption is correct.
My test class has one string property. Does the class have to be marked
with an attribute?

I have made the windows/temp directory read/write (recursive) and given
"Everyone" full control. In addition, I have tried this on Windows
2000, WindowsXP, and Windows .NET 2003 RC2. I'm not sure what to try
next.

Ryan Grimard

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply to this message...
Vote that this is a GOOD answer...
 
Email Archiving and Email Filing - what’s the difference?
Web-based task/todo list management
 
    
Ryan Grimard
Bill, thank you for your prompt response. Your assumption is correct.
My test class has one string property. Does the class have to be marked
with an attribute?

I have made the windows/temp directory read/write (recursive) and given
"Everyone" full control. In addition, I have tried this on Windows
2000, WindowsXP, and Windows .NET 2003 RC2. I'm not sure what to try
next.

Ryan Grimard

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Ryan Grimard
I found the problem! The class I am serializing is a private class. It
seems to work fine when I mark the class as public.

However, when in an ASP.NET application, I still have to give
permissions for the windows/temp folder.

Thanks for your help everyone.

Ryan Grimard

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply to this message...
Vote that this is a GOOD answer...
 
Open source windows
The Law Society’s guidelines on e-mail management
 
    
Christoph Schittko (VIP)
You cannot serialize anything but public classes with the XmlSerializer. The
Framework SDK docs has a fairly complete list of the restrictions for
serializable classes.

HTH,
--
Christoph Schittko
Software Architect, .NET Mentor

"Ryan Grimard" <Click here to reveal e-mail address> wrote in message
news:uxEtgL9xCHA.2132@TK2MSFTNGP11...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Bill Cheng [MSFT]
Hi Ryan,

From the stack trace, I understand that you are executing this code in
ASP.NET application. Therefore, you may try Christoph's suggestion. You may
also try to serialize the class in a console application. If this error
does not occur, the problem should be due to security permissions.

You may get more information in the following article:
Q317012    INFO: Process and Request Identity in ASP.NET
http://support.microsoft.com/default.aspx?scid=KB;en-us;q317012

Feel fee to reply this post if you need our further assistance.

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

Regards,

Bill Cheng
Microsoft Support Engineer
--------------------
| From: Click here to reveal e-mail address (Ryan)
| Subject: XmlSerializer error on instantiation.
| Date: 27 Jan 2003 14:04:02 -0800
| Organization: http://groups.google.com/
| Lines: 80
| Message-ID: <Click here to reveal e-mail address>
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Complaints-To: Click here to reveal e-mail address
| NNTP-Posting-Date: 27 Jan 2003 22:04:02 GMT
| Newsgroups: microsoft.public.dotnet.xml
| NNTP-Posting-Host: vienna7.his.com 216.194.225.92
| Path:
cpmsftngxa08!cpmsftngxa06!TK2MSFTNGP08!TK2MSFTNGP09!vienna7.his.com!nntp1.ro
c.gblx.net!nntp.gblx.net!nntp.gblx.net!newsxfer.visi.net!news-spur1.maxwell.
syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!pos
tnews1.google.com!not-for-mail
| Xref: cpmsftngxa08 microsoft.public.dotnet.xml:10804
| X-Tomcat-NG: microsoft.public.dotnet.xml
|
| I'm trying to serialize a simple class. I'm following the code on
| MSDN Magazine Feb 2003 pg. 27. My class (TestClass) has 1 property (a
| string). I make the following call:
|
| XmlSerializer ser = new XmlSerializer(typeof(TestClass));
|
| I'm in a webapp. I get the following error:
|
| File or assembly name zmp0husw.dll, or one of its dependencies, was
| not found.
| Description: An unhandled exception occurred during the execution of
| the current web request. Please review the stack trace for more
| information about the error and where it originated in the code.
|
| Exception Details: System.IO.FileNotFoundException: File or assembly
| name zmp0husw.dll, or one of its dependencies, was not found.
|
| Source Error:
|
|
| Line 310://                XmlSerializer ser = new
| XmlSerializer(typeof(Report.GenericReport));
| Line 311:                Type t = typeof(TestClass);
| Line 312:                XmlSerializer ser = new XmlSerializer(typeof(TestClass));
| Line 313:                TestClass testClass = new TestClass();
| Line 314:                testClass.Name = "blah";
|
|
| Source File: c:\inetpub\wwwroot\mos_1_2\commoncontrols\ucreport.ascx.cs
| Line: 312
|
| Assembly Load Trace: The following information can be helpful to
| determine why the assembly 'zmp0husw.dll' could not be loaded.
|
|
| === Pre-bind state information ===
| LOG: Where-ref bind. Location = C:\WINDOWS\TEMP\zmp0husw.dll
| LOG: Appbase = file:///c:/inetpub/wwwroot/Mos_1_2
| LOG: Initial PrivatePath = bin
| Calling assembly : (Unknown).
| ===
|
| LOG: Policy not being applied to reference at this time (private,
| custom, partial, or location-based assembly bind).
| LOG: Attempting download of new URL
| file:///C:/WINDOWS/TEMP/zmp0husw.dll.
|
|
|
| Stack Trace:
|
|
| [FileNotFoundException: File or assembly name zmp0husw.dll, or one of
| its dependencies, was not found.]
| System.Reflection.Assembly.nLoad(AssemblyName fileName, String
| codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean
| throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark)
| +0
| System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,
| Boolean stringized, Evidence assemblySecurity, StackCrawlMark&
| stackMark) +307
| System.Reflection.Assembly.Load(AssemblyName assemblyRef) +22
| System.CodeDom.Compiler.CompilerResults.get_CompiledAssembly() +64
| System.Xml.Serialization.Compiler.Compile()
| System.Xml.Serialization.TempAssembly..ctor(XmlMapping[]
| xmlMappings)
|
System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlTypeMapping
| xmlTypeMapping)
| System.Xml.Serialization.XmlSerializer..ctor(Type type)
| Mos.CommonControls.UCReport.LoadReport(String strReportMoniker,
| Boolean bFromSession) in
| c:\inetpub\wwwroot\mos_1_2\commoncontrols\ucreport.ascx.cs:312
| Mos.MarketingPerformanceMonitor.Reports.Page_Load(Object sender,
| EventArgs e) in
c:\inetpub\wwwroot\Mos_1_2\MarketingPerformanceMonitor\Reports.aspx.cs:148
| System.Web.UI.Control.OnLoad(EventArgs e) +67
| System.Web.UI.Control.LoadRecursive() +29
| System.Web.UI.Page.ProcessRequestMain() +724
|
|
| Ryan Grimard
|

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Ryan Grimard
Bill,
I tried this in a Windows Application (Forms) and it didn't work. I
also tried setting the permissions to the windows/temp folder to
"Everyone" full control and read/write. Still doesn't seem to work.

Any other suggestions?

Ryan Grimard

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply to this message...
Vote that this is a GOOD answer...
 
Google Docs… no.
Twitter Elite
 
 
System.CodeDom.Compiler.CompilerResults
System.EventArgs
System.IO.FileNotFoundException
System.Reflection.Assembly
System.Reflection.AssemblyName
System.Security.Cryptography.RC2
System.Web.UI.Control
System.Web.UI.Page
System.Xml.Serialization.XmlMapping
System.Xml.Serialization.XmlSerializer
System.Xml.Serialization.XmlTypeMapping




Ad
BootFX
Reliable and powerful .NET application framework.
Recession Busting Bespoke Software
Get through the recession by investing in bespoke software to decrease costs and create commercial opportunities.
Other DN247 Network Sites
.NET 247
SQL Server Wins
Old Skool Developer
 
Copyright © AMX Software Ltd 2008-2009. Portions copyright © Matthew Baxter-Reynolds 2001-2009. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - .NET 247 is a member of the DN247 Network - 4.0.30129.1734