Strange exception. Help needed.

  • Thread starter Thread starter Martin Christiansen
  • Start date Start date
M

Martin Christiansen

Hi, everyone. I need a bit help here:


I have written an application for my company. That application runs at my
company's customers as part of a larger solution. Now some customers
complain that the application occasionally crashes and/or refuses to start
up.

Here are som facts about the application:
Applikation type: Windows Forms application.
Language : C#
..NET framework : 2.0
Developed using : VS2005
Runs on : Windows XP Prof machines (at customers). Runs under a
regular user account with administrator rights.




Logfiles returned from the customers show that the problem is due to the
following exception:

"Unable to generate a temporary class (result=1). error CS2001: Source file
'C:\WINDOWS\TEMP\xxtyxecu.0.cs' could not be found error CS2008: No inputs
specified"


Having googled around quite a bit I've learned that the real problem might
relate to insufficient rights on the C:\WINDOWS\TEMP folder, which is used
for generating temporary classes on the run (during serialization or
deserialization of classes to/from XML). This makes perfect perfect sense to
me and matches my stack trace.

But every time Google finds a description of the problem, there is always
some ASP, IIS or WebServices involved, which means that the process
generating and compiling the temporary classes runs under another account
(eg IIS_WPG, ASPUSER or NETWORK account). And that account does not have
sufficient rights on the TEMP-folder. The advice in those cases are always
to add the missing rights on the TEMP-folder for those accounts, and that
solution usually works out.

But in my case, it's different. My application is a plain Windows Forms
application that does not make use of any web services or services on any
other machine whatsoever, and my application runs under a plain user account
with all necessary rights (the account can be verified in Task Manager, and
the necessary rights on the TEMP-folder are usually present for both
adimistrators and ordinary users).

So, I can't figure out how a rights-related issue can suddenly arise,
especially when the application is normally running fine. I can't believe
either, that the customers tamper with folder rights and that way create
problems for themselves.

Does anyone have any idea about what is going on? Any help is very much
appreciated.

Regards, Martin, Denmark.
 
Martin said:
Here are som facts about the application:
Applikation type: Windows Forms application.
Language : C#
.NET framework : 2.0
Developed using : VS2005
Runs on : Windows XP Prof machines (at customers). Runs under a
regular user account with administrator rights.
Logfiles returned from the customers show that the problem is due to the
following exception:

"Unable to generate a temporary class (result=1). error CS2001: Source file
'C:\WINDOWS\TEMP\xxtyxecu.0.cs' could not be found error CS2008: No inputs
specified"

Can you test on the machines to see if you are able to create these
files in c:\windows\temp, with e.g. notepad?

What is the value of %TEMP% env variable? For Win XP, it should be a
per-profile temporary directory, squirrelled away under c:\docs &
settings ... username / local settings etc.

It's unusual to see c:\windows\temp being used as a temporary directory
for a desktop app; it's also technically insecure by default, because it
relies on apps setting permisions appropriately so that other users
can't access each other's temp data.
But in my case, it's different. My application is a plain Windows Forms
application that does not make use of any web services or services on any
other machine whatsoever, and my application runs under a plain user account
with all necessary rights (the account can be verified in Task Manager, and
the necessary rights on the TEMP-folder are usually present for both
adimistrators and ordinary users).

-- Barry
 
I agree with Barry in that \windows\temp is not a very good place for temp.

Is your code recompiling some plugin code of some kind on the fly? That is
why all the google hits refer to asp. It can in some modes recompile
serverside code on first reference.

Is it possible that the computer is going to sleep, or in screensaver mode
when this happens? Just a hunch on that one. I've seen an installation that
had some issues when those modes kicked in...
 
I've seen a similar issue, and yes it was when the client app was calling a
webservice and building a custom serialization Dll in that temp folder and
rights were not allowed for the account (IWAM_something).

I'd look for places where the framework might be generating code on the fly
on your behalf, maybe asynchronously, something like
Regex.CompileToAssembly, Xml serialization. If the issue is the same general
one of rights to that temp folder, maybe run FileMon on Windows\Temp and
look for .cs files being created there because it's probably happening even
when it runs normally.
 
Hi, all.

Thank you very much for your input. My problem is that I cannot get to the
client's computers just like thhat, since they are located on board
container vessels. When I try to reconstruct the system at home, there's
never any problem.

I'll try to run FileMon to see, how often the class generation appears, and
I'll also try to remove rights from the Temp-folder one user at a time to
determine under which account the code is running at that point.

If I succeed in finding out what is happening, I'll let you know.

Best regards

- Martin.
 
Back
Top