Could not create Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=

A

alanwo

Hi Expert,


I am the fan of VB My.Application.Log. When I create a new project, it
works but after some times My.Application.Log.WriteEntry nno longer
work. Exception is enclosed:

Could not create Microsoft.VisualBasic.Logging.FileLogTraceListener,
Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL.

System.Configuration.ConfigurationErrorsException was caught
BareMessage="Could not create
Microsoft.VisualBasic.Logging.FileLogTraceListener,
Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL."
Line=0
Message="Could not create
Microsoft.VisualBasic.Logging.FileLogTraceListener,
Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL."
Source="System"
StackTrace:
at System.Diagnostics.TraceUtils.GetRuntimeObject(String
className, Type baseType, String initializeData)
at System.Diagnostics.TypedElement.BaseGetRuntimeObject()
at System.Diagnostics.ListenerElement.GetRuntimeObject()
at System.Diagnostics.ListenerElement.GetRuntimeObject()
at
System.Diagnostics.ListenerElementsCollection.GetRuntimeObject()
at System.Diagnostics.TraceSource.Initialize()
at System.Diagnostics.TraceSource.get_Attributes()
at
Microsoft.VisualBasic.Logging.Log.DefaultTraceSource.get_HasBeenConfigured()
at Microsoft.VisualBasic.Logging.Log..ctor()
at
Microsoft.VisualBasic.ApplicationServices.ApplicationBase.get_Log()
at NoClone.AppLogHelper.LogSearchStart() in C:\Documents and
Settings\Alan\My Documents\Project1\AppLogHelper.vb:line 46



The innerException is {"Illegal characters in path."}

Please advice.

Alan
 
J

Jon Skeet [C# MVP]

I am the fan of VB My.Application.Log. When I create a new project, it
works but after some times My.Application.Log.WriteEntry nno longer
work. Exception is enclosed:

Well, it's suggesting that you've got illegal characters in a path
somewhere. Could you post the code you're using?
 
A

alanwo

My lines of code is simpe:
Try


My.Application.Log.WriteEntry("____________________________________________")
Catch ex As Exception
Debug.Print(ex.Message)
End Try


The stack trace for "Illegal characters in path.":

at
System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String[]
str)
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[] pathList, Boolean checkForDuplicates, Boolean
needFullPath)
at System.IO.Directory.CreateDirectory(String path,
DirectorySecurity directorySecurity)
at System.Windows.Forms.Application.GetDataPath(String basePath)
at System.Windows.Forms.Application.get_UserAppDataPath()
at Microsoft.VisualBasic.Logging.FileLogTraceListener..ctor(String
name)



Jon 寫é“:
 
A

alanwo

MsgBox
(My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData)
also triggered "Illegal characters in path" error.
But
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) do
not.
Strange.

(e-mail address removed) 寫é“:
My lines of code is simpe:
Try


My.Application.Log.WriteEntry("____________________________________________")
Catch ex As Exception
Debug.Print(ex.Message)
End Try


The stack trace for "Illegal characters in path.":

at
System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String[]
str)
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[] pathList, Boolean checkForDuplicates, Boolean
needFullPath)
at System.IO.Directory.CreateDirectory(String path,
DirectorySecurity directorySecurity)
at System.Windows.Forms.Application.GetDataPath(String basePath)
at System.Windows.Forms.Application.get_UserAppDataPath()
at Microsoft.VisualBasic.Logging.FileLogTraceListener..ctor(String
name)



Jon 寫é“:
Well, it's suggesting that you've got illegal characters in a path
somewhere. Could you post the code you're using?
 
A

alanwo

Jon,

I got it, I modified <Assembly: AssemblyVersion("4.0.*.*")> in
AssemblyInfo.vb, * is the reason for illegal path characters. Then the
question is how 4.0.*.* does not work? Oh I found that this is a bug:
http://groups.google.com/group/micr...81988eab0aa?lnk=st&q=&rnum=1#3690e81988eab0aa

Alan

' Version information for an assembly consists of the following four
values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and
Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("4.0.*.*")>
<Assembly: AssemblyFileVersion("4.0.*.*")>


(e-mail address removed) 寫é“:
MsgBox
(My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData)
also triggered "Illegal characters in path" error.
But
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) do
not.
Strange.

(e-mail address removed) 寫é“:
My lines of code is simpe:
Try


My.Application.Log.WriteEntry("____________________________________________")
Catch ex As Exception
Debug.Print(ex.Message)
End Try


The stack trace for "Illegal characters in path.":

at
System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String[]
str)
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[] pathList, Boolean checkForDuplicates, Boolean
needFullPath)
at System.IO.Directory.CreateDirectory(String path,
DirectorySecurity directorySecurity)
at System.Windows.Forms.Application.GetDataPath(String basePath)
at System.Windows.Forms.Application.get_UserAppDataPath()
at Microsoft.VisualBasic.Logging.FileLogTraceListener..ctor(String
name)



Jon 寫é“:
I am the fan of VB My.Application.Log. When I create a new project,it
works but after some times My.Application.Log.WriteEntry nno longer
work. Exception is enclosed:

Well, it's suggesting that you've got illegal characters in a path
somewhere. Could you post the code you're using?
 

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