System.ArgumentException in Environment.GetFolderPath

  • Thread starter Thread starter Thorsten Prölß
  • Start date Start date
T

Thorsten Prölß

Hello,

I have an issue using a typed dataset. Accessing the connection property of
the related TableAdapter, I get a System.ArgumentException.
The code does well on hundreds of pc's. Only on one customer pc we have this
specific issue. The affected machine has an Windows XP OS with .NET 2.0.

The exception:
Type: System.ArgumentException
Message:
Absolute path information is required.
Class: System.Security.Util.StringExpressionSet
Method: System.Collections.ArrayList
CreateListFromExpressions(System.String[], Boolean)
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
StackTrace:
at
System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[]
str, Boolean needFullPath)
at
System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess
access, AccessControlActions control, String[] pathListOrig, Boolean
checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at
System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess
access, String path)
at System.Environment.GetFolderPath(SpecialFolder folder)
at System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean
includeUserConfig)
at System.Configuration.ClientConfigPaths.GetPaths(String exePath,
Boolean includeUserConfig)
at
System.Configuration.Internal.ConfigurationManagerInternal.System.Configuration.Internal.IConfigurationManagerInternal.get_ExeProductName()
at System.Configuration.ApplicationSettingsBase.get_Initializer()
at
System.Configuration.ApplicationSettingsBase.CreateSetting(PropertyInfo
propInfo)
at System.Configuration.ApplicationSettingsBase.EnsureInitialized()
at System.Configuration.ApplicationSettingsBase.get_Properties()
at System.Configuration.SettingsBase.GetPropertyValueByName(String
propertyName)
at System.Configuration.SettingsBase.get_Item(String propertyName)
at System.Configuration.ApplicationSettingsBase.GetPropertyValue(String
propertyName)
at System.Configuration.ApplicationSettingsBase.get_Item(String
propertyName)
at Datev.Pegnitz.Properties.Settings.get_UAConnectionStringForDevelopment()
at
Datev.Pegnitz.Transfer.ProductTableAdapters.ProductsTableAdapter.get_Connection()
at
Datev.Pegnitz.DataAccess.DataManager.Datev.Pegnitz.DataAccess.IDataManager.GetProductsByDerivat(String licenseComponentId)
at Datev.Pegnitz.Business.ApplicationStartup.FillProductInformation()

I have made a demo exe and run it on the client's pc to enclose this
issue. The exe is a simple WinForm, with a button click calling
System.Environment.GetFolderPath(ApplicationData).
This call causes following exception:

ApplicationData
Exception:
Message:
Absolute path information is required.
Source
mscorlib
StackTrace
at
System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[]
str, Boolean needFullPath)
at
System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess
access, AccessControlActions control, String[] pathListOrig, Boolean
checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at
System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess
access, String path)
at System.Environment.GetFolderPath(SpecialFolder folder)
at Pfadermittlung.Form1.showFolders()

Calling GetFolderPath for all other values of Environment.SpecialFolder
(e.g. Programs, Desktop, MyDocuments ...) does work well.
Ok, it seems to be somthing wrong with the ApplicationData-path.

How can I find out what .Net thinks, the ApplicationData-Path is? Is there
a registry setting for this path?
Is this a security issu or is it an issue with syntactical wrong path
information like e.g. missing backslash between drive letter and folder path?

Thorsten
 
Ok, we found the problem.
Changing the registry value
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell
Folders\AppData from O: to O:\ fixed this issue.

Thorsten Prölß said:
Hello,

I have an issue using a typed dataset. Accessing the connection property of
the related TableAdapter, I get a System.ArgumentException.
The code does well on hundreds of pc's. Only on one customer pc we have this
specific issue. The affected machine has an Windows XP OS with .NET 2.0.

The exception:
Type: System.ArgumentException
Message:
Absolute path information is required.
Class: System.Security.Util.StringExpressionSet
Method: System.Collections.ArrayList
CreateListFromExpressions(System.String[], Boolean)
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
StackTrace:
at
System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[]
str, Boolean needFullPath)
at
System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess
access, AccessControlActions control, String[] pathListOrig, Boolean
checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at
System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess
access, String path)
at System.Environment.GetFolderPath(SpecialFolder folder)
at System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean
includeUserConfig)
at System.Configuration.ClientConfigPaths.GetPaths(String exePath,
Boolean includeUserConfig)
at
System.Configuration.Internal.ConfigurationManagerInternal.System.Configuration.Internal.IConfigurationManagerInternal.get_ExeProductName()
at System.Configuration.ApplicationSettingsBase.get_Initializer()
at
System.Configuration.ApplicationSettingsBase.CreateSetting(PropertyInfo
propInfo)
at System.Configuration.ApplicationSettingsBase.EnsureInitialized()
at System.Configuration.ApplicationSettingsBase.get_Properties()
at System.Configuration.SettingsBase.GetPropertyValueByName(String
propertyName)
at System.Configuration.SettingsBase.get_Item(String propertyName)
at System.Configuration.ApplicationSettingsBase.GetPropertyValue(String
propertyName)
at System.Configuration.ApplicationSettingsBase.get_Item(String
propertyName)
at Datev.Pegnitz.Properties.Settings.get_UAConnectionStringForDevelopment()
at
Datev.Pegnitz.Transfer.ProductTableAdapters.ProductsTableAdapter.get_Connection()
at
Datev.Pegnitz.DataAccess.DataManager.Datev.Pegnitz.DataAccess.IDataManager.GetProductsByDerivat(String licenseComponentId)
at Datev.Pegnitz.Business.ApplicationStartup.FillProductInformation()

I have made a demo exe and run it on the client's pc to enclose this
issue. The exe is a simple WinForm, with a button click calling
System.Environment.GetFolderPath(ApplicationData).
This call causes following exception:

ApplicationData
Exception:
Message:
Absolute path information is required.
Source
mscorlib
StackTrace
at
System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[]
str, Boolean needFullPath)
at
System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess
access, AccessControlActions control, String[] pathListOrig, Boolean
checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at
System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess
access, String path)
at System.Environment.GetFolderPath(SpecialFolder folder)
at Pfadermittlung.Form1.showFolders()

Calling GetFolderPath for all other values of Environment.SpecialFolder
(e.g. Programs, Desktop, MyDocuments ...) does work well.
Ok, it seems to be somthing wrong with the ApplicationData-path.

How can I find out what .Net thinks, the ApplicationData-Path is? Is there
a registry setting for this path?
Is this a security issu or is it an issue with syntactical wrong path
information like e.g. missing backslash between drive letter and folder path?

Thorsten
 
Back
Top