path is not of a legal form for FileSystemWatcher if I get path from

Hi,

the following:

FileSystemWatcher watcher = new FileSystemWatcher();
RenderingQ = ConfigurationSettings.AppSettings["RenderingQ"];
//RenderingQ = "C:\\RenditionServerQ\\InjectorQ\\OnDemandQ";
watcher.Path = RenderingQ;

raises the following error:

An unhandled exception of type 'System.ArgumentException' occurred in
mscorlib.dll

Additional information: The path is not of a legal form.

It's somewhat weird because
1. I have tried with both C:\\RenditionServerQ\\InjectorQ\\OnDemandQ
and C:\RenditionServerQ\InjectorQ\OnDemandQ as the value of the
RenderingQ configuration app settings.

2. RenderingQ is declared as a string.

The configuration settings are as follows:

<userSettings>
<WindowsService2.Properties.Settings>
<setting name="RenderingQ" serializeAs="String">
<value>C:\RenditionServerQ\InjectorQ\OnDemandQ</value>
</setting>
</WindowsService2.Properties.Settings>
</userSettings>


If I do the following:

EventLog.WriteEntry(ConfigurationManager.AppSettings["Render ingQ"]);
I get a blank entry in the event log. So what's that about?
bryan rasmussen [ Mo, 07 Januar 2008 14:06 ] [ ID #1901472 ]

RE: path is not of a legal form for FileSystemWatcher if I get path fr

Well, I think that getting a blank in the event log is telling you there is
something wrong with the setting that you are loading. A blank value would
give you an illegal form error for the path on the file system watcher.

"pantagruel" wrote:

> Hi,
>
> the following:
>
> FileSystemWatcher watcher = new FileSystemWatcher();
> RenderingQ = ConfigurationSettings.AppSettings["RenderingQ"];
> //RenderingQ = "C:\\RenditionServerQ\\InjectorQ\\OnDemandQ";
> watcher.Path = RenderingQ;
>
> raises the following error:
>
> An unhandled exception of type 'System.ArgumentException' occurred in
> mscorlib.dll
>
> Additional information: The path is not of a legal form.
>
> It's somewhat weird because
> 1. I have tried with both C:\\RenditionServerQ\\InjectorQ\\OnDemandQ
> and C:\RenditionServerQ\InjectorQ\OnDemandQ as the value of the
> RenderingQ configuration app settings.
>
> 2. RenderingQ is declared as a string.
>
> The configuration settings are as follows:
>
> <userSettings>
> <WindowsService2.Properties.Settings>
> <setting name="RenderingQ" serializeAs="String">
> <value>C:\RenditionServerQ\InjectorQ\OnDemandQ</value>
> </setting>
> </WindowsService2.Properties.Settings>
> </userSettings>
>
>
> If I do the following:
>
> EventLog.WriteEntry(ConfigurationManager.AppSettings["Render ingQ"]);
> I get a blank entry in the event log. So what's that about?
>
>
FamilyTreeMike [ Mo, 07 Januar 2008 17:42 ] [ ID #1901479 ]

Re: path is not of a legal form for FileSystemWatcher if I get path

Yeah, I suppose there's something wrong as well. But I can't really
see what that is. The setting name is the same as the value I am
passing, certainly looks like it above. I've tried two different path
values.
I've tried with both ConfigurationManager.AppSettings and
ConfigurationSettings.AppSettings,

So the question is why would this as my app settings:

<userSettings>
<WindowsService2.Properties.Settings>
<setting name="RenderingQ" serializeAs="String">
<value>C:\RenditionServerQ\InjectorQ\OnDemandQ</value>
</setting>
</WindowsService2.Properties.Settings>
</userSettings>

give a blank value for this


ConfigurationManager.AppSettings["RenderingQ"]



On Jan 7, 5:42 pm, Family Tree Mike
<FamilyTreeM... [at] discussions.microsoft.com> wrote:
> Well, I think that getting a blank in the event log is telling you there is
> something wrong with the setting that you are loading. A blank value would
> give you an illegal form error for the path on the file system watcher.
>
> "pantagruel" wrote:
> > Hi,
>
> > the following:
>
> > FileSystemWatcher watcher = new FileSystemWatcher();
> > RenderingQ = ConfigurationSettings.AppSettings["RenderingQ"];
> > //RenderingQ = "C:\\RenditionServerQ\\InjectorQ\\OnDemandQ";
> > watcher.Path = RenderingQ;
>
> > raises the following error:
>
> > An unhandled exception of type 'System.ArgumentException' occurred in
> > mscorlib.dll
>
> > Additional information: The path is not of a legal form.
>
> > It's somewhat weird because
> > 1. I have tried with both C:\\RenditionServerQ\\InjectorQ\\OnDemandQ
> > and C:\RenditionServerQ\InjectorQ\OnDemandQ as the value of the
> > RenderingQ configuration app settings.
>
> > 2. RenderingQ is declared as a string.
>
> > The configuration settings are as follows:
>
> > <userSettings>
> > <WindowsService2.Properties.Settings>
> > <setting name="RenderingQ" serializeAs="String">
> > <value>C:\RenditionServerQ\InjectorQ\OnDemandQ</value>
> > </setting>
> > </WindowsService2.Properties.Settings>
> > </userSettings>
>
> > If I do the following:
>
> > EventLog.WriteEntry(ConfigurationManager.AppSettings["Render ingQ"]);
> > I get a blank entry in the event log. So what's that about?
bryan rasmussen [ Di, 08 Januar 2008 10:24 ] [ ID #1902445 ]

Re: path is not of a legal form for FileSystemWatcher if I get pat

Are you getting any values from your settings that are valid?

If not, try something like the following and see if your code is having
trouble finding the config file.

string[] keys = appSettings.AllKeys;

Console.WriteLine();
Console.WriteLine("Application appSettings:");

// Loop to get key/value pairs.
for (int i = 0; i < appSettings.Count; i++)

Console.WriteLine("#{0} Name: {1} Value: {2}",
i, keys[i], appSettings[i]);



"pantagruel" wrote:

>
> Yeah, I suppose there's something wrong as well. But I can't really
> see what that is. The setting name is the same as the value I am
> passing, certainly looks like it above. I've tried two different path
> values.
> I've tried with both ConfigurationManager.AppSettings and
> ConfigurationSettings.AppSettings,
>
> So the question is why would this as my app settings:
>
> <userSettings>
> <WindowsService2.Properties.Settings>
> <setting name="RenderingQ" serializeAs="String">
> <value>C:\RenditionServerQ\InjectorQ\OnDemandQ</value>
> </setting>
> </WindowsService2.Properties.Settings>
> </userSettings>
>
> give a blank value for this
>
>
> ConfigurationManager.AppSettings["RenderingQ"]
>
>
>
> On Jan 7, 5:42 pm, Family Tree Mike
> <FamilyTreeM... [at] discussions.microsoft.com> wrote:
> > Well, I think that getting a blank in the event log is telling you there is
> > something wrong with the setting that you are loading. A blank value would
> > give you an illegal form error for the path on the file system watcher.
> >
> > "pantagruel" wrote:
> > > Hi,
> >
> > > the following:
> >
> > > FileSystemWatcher watcher = new FileSystemWatcher();
> > > RenderingQ = ConfigurationSettings.AppSettings["RenderingQ"];
> > > //RenderingQ = "C:\\RenditionServerQ\\InjectorQ\\OnDemandQ";
> > > watcher.Path = RenderingQ;
> >
> > > raises the following error:
> >
> > > An unhandled exception of type 'System.ArgumentException' occurred in
> > > mscorlib.dll
> >
> > > Additional information: The path is not of a legal form.
> >
> > > It's somewhat weird because
> > > 1. I have tried with both C:\\RenditionServerQ\\InjectorQ\\OnDemandQ
> > > and C:\RenditionServerQ\InjectorQ\OnDemandQ as the value of the
> > > RenderingQ configuration app settings.
> >
> > > 2. RenderingQ is declared as a string.
> >
> > > The configuration settings are as follows:
> >
> > > <userSettings>
> > > <WindowsService2.Properties.Settings>
> > > <setting name="RenderingQ" serializeAs="String">
> > > <value>C:\RenditionServerQ\InjectorQ\OnDemandQ</value>
> > > </setting>
> > > </WindowsService2.Properties.Settings>
> > > </userSettings>
> >
> > > If I do the following:
> >
> > > EventLog.WriteEntry(ConfigurationManager.AppSettings["Render ingQ"]);
> > > I get a blank entry in the event log. So what's that about?
>
FamilyTreeMike [ Di, 08 Januar 2008 12:39 ] [ ID #1902446 ]
Microsoft » microsoft.public.dotnet.general » path is not of a legal form for FileSystemWatcher if I get path from

Vorheriges Thema: On some computer screens, my controls are TOO LARGE???
Nächstes Thema: Clickonce, <fileAssociation> and passed parameters