The surrogate pair is invalid.

M

MikeB

Hello All,

I have a console application that is run via a scheduled task everyday at 4
in the morning. For some reason, a couple of days ago, every time the
scheduled task is run (ether manually or by scheduled time) I get a "The
surrogate pair is invalid" error. When ever I manually run the app by
double clicking it, it runs fine. Any ideas what could be causing this
error? It used to run fine previously and am pretty sure nothing changed on
the server.

Its a C# 2.0 application.

TIA
 
T

Tom Porterfield

MikeB said:
Hello All,

I have a console application that is run via a scheduled task everyday at 4
in the morning. For some reason, a couple of days ago, every time the
scheduled task is run (ether manually or by scheduled time) I get a "The
surrogate pair is invalid" error. When ever I manually run the app by
double clicking it, it runs fine. Any ideas what could be causing this
error? It used to run fine previously and am pretty sure nothing changed on
the server.

Its a C# 2.0 application.

Are you using xml serialization? That error often comes up if there is
something invalid in the data that is being read/written to XML is
invalid or incorrect.

As to why you would only see this when running as a scheduled task
rather than when directly running the program, you need to look at
credentials. When you run the program manually it is running under the
context of the logged on user. What credentials does the scheduled task
run under (typically found in the properties for the scheduled task)?
My guess would be that the credentials that the task is running under do
not have access to some resource that the application assumes will
always be available.

If you can provide more details around where in the code the error is
being thrown and what the code is doing at that point, that would help
troubleshoot this problem further.
 
M

MikeB

I am running it under the same credentials as I am log in as so I am not
sure what is going on with that. I will have to add some more logging to
figure out exactly where this is happening at since it works fine when I
debug it. thanks
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

MikeB said:
Hello All,

I have a console application that is run via a scheduled task everyday at
4 in the morning. For some reason, a couple of days ago, every time the
scheduled task is run (ether manually or by scheduled time) I get a "The
surrogate pair is invalid" error. When ever I manually run the app by
double clicking it, it runs fine. Any ideas what could be causing this
error? It used to run fine previously and am pretty sure nothing changed
on the server.

You will need to provide more details, is this a .net error? in which line
you get it?
You should handle AppDomain.UnhandledException and log it somewhere.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top