I got some problem unexpectedly. There error is
The expression "[System.IO.Path]::GetFullPath(obj\Debug\net7.0\Razor***.razor.g.cs)" cannot be evaluated. Illegal characters in path.
This ** file is automatic comes in my project some time it gone but now I can not find the solution
System.AggregateException: One or more errors occurred.
(Inner Exception #0) System.ArgumentException: Illegal characters in path.
at System.Security.Permissions.FileIOPermission.EmulateFileIOPermissionChecks(String fullPath) at System.Security.Permissions.FileIOPermission.QuickDemand(FileIOPermissionAccess access, String fullPath, Boolean checkForDuplicates, Boolean needFullPath) at System.IO.FileInfo.Init(String fileName, Boolean checkHost) at Microsoft.AspNetCore.Razor.Language.DefaultRazorProjectFileSystem.GetItem(String path, String fileKind) at Microsoft.CodeAnalysis.Razor.ProjectSystem.ProjectState.GetImportDocumentTargetPaths(String targetPath, String fileKind, RazorProjectEngine projectEngine) at Microsoft.CodeAnalysis.Razor.ProjectSystem.ProjectState.AddDocument(DocumentState state) at Microsoft.CodeAnalysis.Razor.ProjectSystem.ProjectSnapshotManager.TryUpdateProject(ProjectKey projectKey, Func
2 transformer, Action onAfterUpdate, IProjectSnapshot& oldProject, IProjectSnapshot& newProject, Boolean& isSolutionClosing) at Microsoft.CodeAnalysis.Razor.ProjectSystem.ProjectSnapshotManager.AddDocument(ProjectKey projectKey, HostDocument hostDocument, TextLoader textLoader) at Microsoft.VisualStudio.Razor.ProjectSystem.DefaultWindowsRazorProjectHost.<>c__DisplayClass4_1.<HandleProjectChangeAsync>b__2(Updater updater) at Microsoft.VisualStudio.Razor.ProjectSystem.WindowsRazorProjectHostBase.<>c.<UpdateAsync>b__31_0(Updater updater, ValueTuple
2 state) at Microsoft.CodeAnalysis.Razor.ProjectSystem.ProjectSnapshotManager.<>c__461.<UpdateAsync>b__46_0(ValueTuple
3 x) at Microsoft.CodeAnalysis.Razor.ProjectSystem.ProjectSnapshotManager.Dispatcher.<>c__DisplayClass9_0`1.b__0() at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Razor.ProjectSystem.DefaultWindowsRazorProjectHost.d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Razor.ProjectSystem.WindowsRazorProjectHostBase.d__34.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.ProjectSystem.CommonProjectSystemTools.<>c__DisplayClass23_0.<b__0>d.MoveNext() <--- (Inner Exception #0)
I try many solution like delete bin and obj folder from the project and I also restart visual studio and restart computer I could not find effective solution. Help me