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
Jon Skeet [C# MVP] - 29 Jul 2006 11:41 GMT
> 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?

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
alanwo@gmail.com - 30 Jul 2006 11:17 GMT
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
[quoted text clipped - 7 lines]
> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
> If replying to the group, please do not mail me too
alanwo@gmail.com - 30 Jul 2006 12:03 GMT
MsgBox
(My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData)
also triggered "Illegal characters in path" error.
But
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) do
not.
Strange.
alanwo@gmail.com 寫道:
> My lines of code is simpe:
> Try
[quoted text clipped - 37 lines]
> > http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
> > If replying to the group, please do not mail me too
alanwo@gmail.com - 30 Jul 2006 12:25 GMT
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/microsoft.public.dotnet.languages.vb/browse_threa
d/thread/e5ce7ce8b956307c/3690e81988eab0aa?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.*.*")>
alanwo@gmail.com 寫道:
> MsgBox
> (My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData)
[quoted text clipped - 47 lines]
> > > http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
> > > If replying to the group, please do not mail me too
Jon Skeet [C# MVP] - 01 Aug 2006 20:15 GMT
> 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/microsoft.public.dotnet.languages.vb/
> browse_thread/thread/e5ce7ce8b956307c/3690e81988eab0aa?lnk=st&q=&rnum=
> 1#3690e81988eab0aa
Hmm. Odd. I'm afraid I don't know anything more about that :(

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too