Launching app on startup gives error

  • Thread starter Thread starter rob2
  • Start date Start date
R

rob2

I have written a C# application that runs fine from within the IDE,
and also when I invoke it via the Windows 'Run' dialog or from
explorer. I am trying to make the app launch automatically when
windows starts, and have placed a registry value under
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
to run the .exe. This worked for a while, but now I have added some
code which performs deserialization of some data as the app starts up,
and this is throwing errors, but only when the app is invoked via the
registry as windows starts - otherwise, no errors and everything works
fine. I have tried both binary and xml serialization, as well as
custom serialization via ISerializable - nothing works.

This is the error I get when using XML serialization:
System.InvalidOperationException: There is an error in XML document
(0, 0). ---> System.ArgumentException: Invalid byte was found at byte
index 5.
however the document looked fine to me when I opened it in a text
editor

The binary formatter gave this error:
System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an invocation. --->
System.Runtime.Serialization.SerializationException: Member
dlSecondBuffer was not found.
the member it mentions *was* in the object, and could be accessed
normally when the app was launched 'by hand'

Could this be a permissions issue? Any other ideas?
many thanks for your help
rob
 
rob2 said:
I have written a C# application that runs fine from within the IDE,
and also when I invoke it via the Windows 'Run' dialog or from
explorer. I am trying to make the app launch automatically when
windows starts, and have placed a registry value under
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
to run the .exe. This worked for a while, but now I have added some
code which performs deserialization of some data as the app starts up,
and this is throwing errors, but only when the app is invoked via the
registry as windows starts - otherwise, no errors and everything works
fine. I have tried both binary and xml serialization, as well as
custom serialization via ISerializable - nothing works.

This is the error I get when using XML serialization:
System.InvalidOperationException: There is an error in XML document
(0, 0). ---> System.ArgumentException: Invalid byte was found at byte
index 5.
however the document looked fine to me when I opened it in a text
editor

The binary formatter gave this error:
System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an invocation. --->
System.Runtime.Serialization.SerializationException: Member
dlSecondBuffer was not found.
the member it mentions *was* in the object, and could be accessed
normally when the app was launched 'by hand'

Could this be a permissions issue? Any other ideas?
many thanks for your help
rob


Well, i would try to put the autostart key to
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
instead of HKEY_CURRENT_USER and check what happens

Andrey
 
Well, i would try to put the autostart key to
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
instead of HKEY_CURRENT_USER and check what happens

Andrey

It does the same thing unfortunately - that was one of the things I
tried, but thanks anyway

rob
 
I have written a C# application that runs fine from within the IDE,
and also when I invoke it via the Windows 'Run' dialog or from
explorer. I am trying to make the app launch automatically when
windows starts, and have placed a registry value under
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
to run the .exe. This worked for a while, but now I have added some
code which performs deserialization of some data as the app starts up,
and this is throwing errors, but only when the app is invoked via the
registry as windows starts - otherwise, no errors and everything works
fine. I have tried both binary and xml serialization, as well as
custom serialization via ISerializable - nothing works.

This is the error I get when using XML serialization:
System.InvalidOperationException: There is an error in XML document
(0, 0). ---> System.ArgumentException: Invalid byte was found at byte
index 5.
however the document looked fine to me when I opened it in a text
editor

The binary formatter gave this error:
System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an invocation. --->
System.Runtime.Serialization.SerializationException: Member
dlSecondBuffer was not found.
the member it mentions *was* in the object, and could be accessed
normally when the app was launched 'by hand'

Could this be a permissions issue? Any other ideas?
many thanks for your help
rob

I know this is a busy group, but does anyone have any thoughts on
this? - my application is basically ready now apart from this issue,
and I cant see a way around it
thanks
rob
 
Back
Top