Click here to Skip to main content
15,868,164 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am using Consuming Nouget Package VirtualDesktop in my desktop application. When I call
VirtualDesktop.IsSupported

then it returns True. But When I call
VirtualDesktop.IsPinned(handle)

it returns following exception.


Exception:Empty path name is not legal. (Parameter 'path')

 StackTrace:   at System.IO.Strategies.FileStreamHelpers.ValidateArguments(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
   at Roslyn.Utilities.StandardFileSystem.OpenFile(String filePath, FileMode mode, FileAccess access, FileShare share)
   at Roslyn.Utilities.CommonCompilerFileSystemExtensions.OpenFileWithNormalizedException(ICommonCompilerFileSystem fileSystem, String filePath, FileMode fileMode, FileAccess fileAccess, FileShare fileShare)
   at WindowsDesktop.Interop.ComInterfaceAssemblyBuilder.<>c.<Compile>b__14_2(Assembly x)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
   at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable`1 items)
   at Microsoft.CodeAnalysis.Compilation.ValidateReferences[T](IEnumerable`1 references)
   at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.WithReferences(IEnumerable`1 references)
   at WindowsDesktop.Interop.ComInterfaceAssemblyBuilder.Compile(IEnumerable`1 sources)
   at WindowsDesktop.Interop.ComInterfaceAssemblyBuilder.CreateAssembly()
   at WindowsDesktop.Interop.ComInterfaceAssemblyBuilder.GetAssembly()
   at WindowsDesktop.VirtualDesktop.InitializeCore()
   at WindowsDesktop.VirtualDesktop.FromHwnd(IntPtr hWnd)
   at MyProject.DB.DTOs.ActiveApplication.<>c__DisplayClass138_0.<AssignVirtualDesktop>b__0() in D:/ProjectPath


What I have tried:

It works fine on my Dev machine but failed on all production machines. When I installed Dev tools (Visual studio 2022), it works fine too on that machine.
I am making executable by publish option available in VS-2022.

Note: I have found that When I publish by checking option Produce Single File then this exception occurs. If unchecked this option, then works fine but there is list of files are generated.
How to resolve it with Produce Single File option selected ???
Posted
Updated 25-Oct-22 22:22pm
v3
Comments
Graeme_Grant 22-Oct-22 8:02am    
Have you asked the creator of the lib?
DoingWork 26-Oct-22 4:23am    
I have found that When I publish by checking option Produce Single File then this exception occurs. If unchecked this option, then works fine but there is list of files are generated.
How to resolve it with Produce Single File option selected ???

1 solution

THis error message explains what is happening:
Exception:Empty path name is not legal. (Parameter 'path')

It is expecting a value, not an empty path
 
Share this answer
 
Comments
DoingWork 23-Oct-22 11:16am    
I am passing handle of process which is not empty.
Graeme_Grant 23-Oct-22 13:54pm    
The error message is indicating that you are missing something or the Lib that you are using has a bug. I am not familiar with this lib, nor can I see from your code above what that might be.
DoingWork 26-Oct-22 4:20am    
I have found that When I publish by checking option Produce Single File then this exception occurs. If unchecked this option, then works fine but there is list of files are generated.
How to resolve it with Produce Single File option selected.
Graeme_Grant 26-Oct-22 4:35am    
I can only point to what the issue is as I do not use that lib. Probably best you ask the author of the lib.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900