[GH-ISSUE #169] An attempt was made to load an assembly from a network location #143

Closed
opened 2026-02-26 11:56:54 +03:00 by kerem · 11 comments
Owner

Originally created by @majkinetor on GitHub (Dec 8, 2021).
Original GitHub issue: https://github.com/1Remote/1Remote/issues/169

Originally assigned to: @VShawn on GitHub.

Environment

Component Version
PRemoteM 0.6.0-beta(EXE Release)
.NET Framework .NET Framework 4.8
CLR 4.0.30319.42000
OS Windows 10 Enterprise 64-bits 6.2.9200.0 (2009)

Error Info

An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.

Stack Trace

   at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
   at System.Reflection.Assembly.LoadFile(String path)
   at VariableKeywordMatcher.Builder.LoadProviders()
   at VariableKeywordMatcher.Builder.Build(IEnumerable`1 enabledProviderNames, Boolean isCaseSensitive)
   at PRM.Core.Service.KeywordMatchService..ctor() in D:\DemoProject\PRemoteM\PRM.Core\Service\KeywordMatchService.cs:line 92
   at PRM.Core.Model.PrmContext..ctor(Boolean isPortable, ResourceDictionary applicationResourceDictionary) in D:\DemoProject\PRemoteM\PRM.Core\Model\PrmContext.cs:line 30
   at PRM.App.App_OnStartup(Object sender, StartupEventArgs startupEvent) in D:\DemoProject\PRemoteM\PRemoteM\App.xaml.cs:line 156
   at System.Windows.Application.OnStartup(StartupEventArgs e)
   at System.Windows.Application.<.ctor>b__1_0(Object unused)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Recent Log

2021-12-08T20:39:50.8300140+01:00[ThreadId:0000000001]		Fatal		System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
   at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
   at System.Reflection.Assembly.LoadFile(String path)
   at VariableKeywordMatcher.Builder.LoadProviders()
   at VariableKeywordMatcher.Builder.Build(IEnumerable`1 enabledProviderNames, Boolean isCaseSensitive)
   at PRM.Core.Service.KeywordMatchService..ctor() in D:\DemoProject\PRemoteM\PRM.Core\Service\KeywordMatchService.cs:line 92
   at PRM.Core.Model.PrmContext..ctor(Boolean isPortable, ResourceDictionary applicationResourceDictionary) in D:\DemoProject\PRemoteM\PRM.Core\Model\PrmContext.cs:line 30
   at PRM.App.App_OnStartup(Object sender, StartupEventArgs startupEvent) in D:\DemoProject\PRemoteM\PRemoteM\App.xaml.cs:line 156
   at System.Windows.Application.OnStartup(StartupEventArgs e)
   at System.Windows.Application.<.ctor>b__1_0(Object unused)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
   at System.Reflection.Assembly.LoadFile(String path)
   at VariableKeywordMatcher.Builder.LoadProviders()
   at VariableKeywordMatcher.Builder.Build(IEnumerable`1 enabledProviderNames, Boolean isCaseSensitive)
   at PRM.Core.Service.KeywordMatchService..ctor() in D:\DemoProject\PRemoteM\PRM.Core\Service\KeywordMatchService.cs:line 92
   at PRM.Core.Model.PrmContext..ctor(Boolean isPortable, ResourceDictionary applicationResourceDictionary) in D:\DemoProject\PRemoteM\PRM.Core\Model\PrmContext.cs:line 30
   at PRM.App.App_OnStartup(Object sender, StartupEventArgs startupEvent) in D:\DemoProject\PRemoteM\PRemoteM\App.xaml.cs:line 156
   at System.Windows.Application.OnStartup(StartupEventArgs e)
   at System.Windows.Application.<.ctor>b__1_0(Object unused)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Originally created by @majkinetor on GitHub (Dec 8, 2021). Original GitHub issue: https://github.com/1Remote/1Remote/issues/169 Originally assigned to: @VShawn on GitHub. <details> ## Environment | Component | Version | |:------------------|:--------------------------------------| |PRemoteM | `0.6.0-beta`(EXE Release)| |.NET Framework | `.NET Framework 4.8` | |CLR | `4.0.30319.42000` | |OS | `Windows 10 Enterprise 64-bits 6.2.9200.0 (2009)` | ## Error Info An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information. ## Stack Trace ``` at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence) at System.Reflection.Assembly.LoadFile(String path) at VariableKeywordMatcher.Builder.LoadProviders() at VariableKeywordMatcher.Builder.Build(IEnumerable`1 enabledProviderNames, Boolean isCaseSensitive) at PRM.Core.Service.KeywordMatchService..ctor() in D:\DemoProject\PRemoteM\PRM.Core\Service\KeywordMatchService.cs:line 92 at PRM.Core.Model.PrmContext..ctor(Boolean isPortable, ResourceDictionary applicationResourceDictionary) in D:\DemoProject\PRemoteM\PRM.Core\Model\PrmContext.cs:line 30 at PRM.App.App_OnStartup(Object sender, StartupEventArgs startupEvent) in D:\DemoProject\PRemoteM\PRemoteM\App.xaml.cs:line 156 at System.Windows.Application.OnStartup(StartupEventArgs e) at System.Windows.Application.<.ctor>b__1_0(Object unused) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) ``` ## Recent Log ``` 2021-12-08T20:39:50.8300140+01:00[ThreadId:0000000001] Fatal System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information. at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence) at System.Reflection.Assembly.LoadFile(String path) at VariableKeywordMatcher.Builder.LoadProviders() at VariableKeywordMatcher.Builder.Build(IEnumerable`1 enabledProviderNames, Boolean isCaseSensitive) at PRM.Core.Service.KeywordMatchService..ctor() in D:\DemoProject\PRemoteM\PRM.Core\Service\KeywordMatchService.cs:line 92 at PRM.Core.Model.PrmContext..ctor(Boolean isPortable, ResourceDictionary applicationResourceDictionary) in D:\DemoProject\PRemoteM\PRM.Core\Model\PrmContext.cs:line 30 at PRM.App.App_OnStartup(Object sender, StartupEventArgs startupEvent) in D:\DemoProject\PRemoteM\PRemoteM\App.xaml.cs:line 156 at System.Windows.Application.OnStartup(StartupEventArgs e) at System.Windows.Application.<.ctor>b__1_0(Object unused) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence) at System.Reflection.Assembly.LoadFile(String path) at VariableKeywordMatcher.Builder.LoadProviders() at VariableKeywordMatcher.Builder.Build(IEnumerable`1 enabledProviderNames, Boolean isCaseSensitive) at PRM.Core.Service.KeywordMatchService..ctor() in D:\DemoProject\PRemoteM\PRM.Core\Service\KeywordMatchService.cs:line 92 at PRM.Core.Model.PrmContext..ctor(Boolean isPortable, ResourceDictionary applicationResourceDictionary) in D:\DemoProject\PRemoteM\PRM.Core\Model\PrmContext.cs:line 30 at PRM.App.App_OnStartup(Object sender, StartupEventArgs startupEvent) in D:\DemoProject\PRemoteM\PRemoteM\App.xaml.cs:line 156 at System.Windows.Application.OnStartup(StartupEventArgs e) at System.Windows.Application.<.ctor>b__1_0(Object unused) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) ``` </details>
kerem 2026-02-26 11:56:54 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@VShawn commented on GitHub (Dec 8, 2021):

not a bug of new version, check this:

https://github.com/VShawn/PRemoteM/issues/159#issuecomment-969192014

maybe put PRM in a network loaction will cause this exception?

<!-- gh-comment-id:989324399 --> @VShawn commented on GitHub (Dec 8, 2021): not a bug of new version, check this: https://github.com/VShawn/PRemoteM/issues/159#issuecomment-969192014 maybe put PRM in a network loaction will cause this exception?
Author
Owner

@majkinetor commented on GitHub (Dec 9, 2021):

Nah. The location is clearly not from my machine, I don't have D drive or D:\DemoProject. Its different bug, just looks the same.

<!-- gh-comment-id:989600898 --> @majkinetor commented on GitHub (Dec 9, 2021): Nah. The location is clearly not from my machine, I don't have D drive or `D:\DemoProject`. Its different bug, just looks the same.
Author
Owner

@VShawn commented on GitHub (Dec 9, 2021):

D:\DemoProject is my coding location, saving in the .pdb files for show up which file and which line the excepiton occur.

the issue came from An attempt was made to load an assembly from a network location, nothing todo with location D:\DemoProject

<!-- gh-comment-id:989679673 --> @VShawn commented on GitHub (Dec 9, 2021): `D:\DemoProject` is my coding location, saving in the `.pdb` files for show up which file and which line the excepiton occur. the issue came from `An attempt was made to load an assembly from a network location`, nothing todo with location `D:\DemoProject`
Author
Owner

@majkinetor commented on GitHub (Dec 9, 2021):

OK then.

I don't use network location. I just unpacked both zip files locally and started exe without my previous config.

<!-- gh-comment-id:989712931 --> @majkinetor commented on GitHub (Dec 9, 2021): OK then. I don't use network location. I just unpacked both zip files locally and started exe without my previous config.
Author
Owner

@VShawn commented on GitHub (Dec 9, 2021):

I just reproduce An attempt was made to load an assembly from a network location when I unzip PRM to my SMB location and run it.

then, no idea why this exception was thrown.

anyway, since this issue was bring by keyword matcher dll load, I can build a all-in-one matcher (https://github.com/VShawn/VariableKeywordMatcher) and replace the current one.

<!-- gh-comment-id:989768189 --> @VShawn commented on GitHub (Dec 9, 2021): I just reproduce `An attempt was made to load an assembly from a network location` when I unzip PRM to my SMB location and run it. then, no idea why this exception was thrown. anyway, since this issue was bring by keyword matcher dll load, I can build a all-in-one matcher (https://github.com/VShawn/VariableKeywordMatcher) and replace the current one.
Author
Owner

@majkinetor commented on GitHub (Dec 9, 2021):

Tried on another machine, different error:

Environment

Component Version
PRemoteM 0.6.0-beta(EXE Release)
.NET Framework .NET Framework 4.8
CLR 4.0.30319.42000
OS Windows 10 Enterprise 64-bits 6.2.9200.0 (1607)

Error Info

Access to the path is denied.

Stack Trace

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.Pipes.NamedPipeClientStream.Connect(Int32 timeout)
   at Shawn.Utils.OnlyOneAppInstanceHelper.NamedPipeSendMessage(String message) in D:\DemoProject\PRemoteM\PRM.Core\Utils\OnlyOneAppInstanceHelper.cs:line 39
   at PRM.App.OnlyOneAppInstanceCheck() in D:\DemoProject\PRemoteM\PRemoteM\App.xaml.cs:line 90
   at PRM.App.App_OnStartup(Object sender, StartupEventArgs startupEvent) in D:\DemoProject\PRemoteM\PRemoteM\App.xaml.cs:line 153
   at System.Windows.Application.OnStartup(StartupEventArgs e)
   at System.Windows.Application.<.ctor>b__1_0(Object unused)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Recent Log

2021-12-09T12:37:07.2109543+01:00[ThreadId:0000000001]		Fatal		System.UnauthorizedAccessException: Access to the path is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.Pipes.NamedPipeClientStream.Connect(Int32 timeout)
   at Shawn.Utils.OnlyOneAppInstanceHelper.NamedPipeSendMessage(String message) in D:\DemoProject\PRemoteM\PRM.Core\Utils\OnlyOneAppInstanceHelper.cs:line 39
   at PRM.App.OnlyOneAppInstanceCheck() in D:\DemoProject\PRemoteM\PRemoteM\App.xaml.cs:line 90
   at PRM.App.App_OnStartup(Object sender, StartupEventArgs startupEvent) in D:\DemoProject\PRemoteM\PRemoteM\App.xaml.cs:line 153
   at System.Windows.Application.OnStartup(StartupEventArgs e)
   at System.Windows.Application.<.ctor>b__1_0(Object unused)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.Pipes.NamedPipeClientStream.Connect(Int32 timeout)
   at Shawn.Utils.OnlyOneAppInstanceHelper.NamedPipeSendMessage(String message) in D:\DemoProject\PRemoteM\PRM.Core\Utils\OnlyOneAppInstanceHelper.cs:line 39
   at PRM.App.OnlyOneAppInstanceCheck() in D:\DemoProject\PRemoteM\PRemoteM\App.xaml.cs:line 90
   at PRM.App.App_OnStartup(Object sender, StartupEventArgs startupEvent) in D:\DemoProject\PRemoteM\PRemoteM\App.xaml.cs:line 153
   at System.Windows.Application.OnStartup(StartupEventArgs e)
   at System.Windows.Application.<.ctor>b__1_0(Object unused)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

BTW, what is the difference between two .zip files in release ?

<!-- gh-comment-id:989773241 --> @majkinetor commented on GitHub (Dec 9, 2021): Tried on another machine, different error: <details> ## Environment | Component | Version | |:------------------|:--------------------------------------| |PRemoteM | `0.6.0-beta`(EXE Release)| |.NET Framework | `.NET Framework 4.8` | |CLR | `4.0.30319.42000` | |OS | `Windows 10 Enterprise 64-bits 6.2.9200.0 (1607)` | ## Error Info Access to the path is denied. ## Stack Trace ``` at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.Pipes.NamedPipeClientStream.Connect(Int32 timeout) at Shawn.Utils.OnlyOneAppInstanceHelper.NamedPipeSendMessage(String message) in D:\DemoProject\PRemoteM\PRM.Core\Utils\OnlyOneAppInstanceHelper.cs:line 39 at PRM.App.OnlyOneAppInstanceCheck() in D:\DemoProject\PRemoteM\PRemoteM\App.xaml.cs:line 90 at PRM.App.App_OnStartup(Object sender, StartupEventArgs startupEvent) in D:\DemoProject\PRemoteM\PRemoteM\App.xaml.cs:line 153 at System.Windows.Application.OnStartup(StartupEventArgs e) at System.Windows.Application.<.ctor>b__1_0(Object unused) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) ``` ## Recent Log ``` 2021-12-09T12:37:07.2109543+01:00[ThreadId:0000000001] Fatal System.UnauthorizedAccessException: Access to the path is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.Pipes.NamedPipeClientStream.Connect(Int32 timeout) at Shawn.Utils.OnlyOneAppInstanceHelper.NamedPipeSendMessage(String message) in D:\DemoProject\PRemoteM\PRM.Core\Utils\OnlyOneAppInstanceHelper.cs:line 39 at PRM.App.OnlyOneAppInstanceCheck() in D:\DemoProject\PRemoteM\PRemoteM\App.xaml.cs:line 90 at PRM.App.App_OnStartup(Object sender, StartupEventArgs startupEvent) in D:\DemoProject\PRemoteM\PRemoteM\App.xaml.cs:line 153 at System.Windows.Application.OnStartup(StartupEventArgs e) at System.Windows.Application.<.ctor>b__1_0(Object unused) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.Pipes.NamedPipeClientStream.Connect(Int32 timeout) at Shawn.Utils.OnlyOneAppInstanceHelper.NamedPipeSendMessage(String message) in D:\DemoProject\PRemoteM\PRM.Core\Utils\OnlyOneAppInstanceHelper.cs:line 39 at PRM.App.OnlyOneAppInstanceCheck() in D:\DemoProject\PRemoteM\PRemoteM\App.xaml.cs:line 90 at PRM.App.App_OnStartup(Object sender, StartupEventArgs startupEvent) in D:\DemoProject\PRemoteM\PRemoteM\App.xaml.cs:line 153 at System.Windows.Application.OnStartup(StartupEventArgs e) at System.Windows.Application.<.ctor>b__1_0(Object unused) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) ``` </details> BTW, what is the difference between two .zip files in release ?
Author
Owner

@majkinetor commented on GitHub (Dec 9, 2021):

Tried on third machine and it worked :)

<!-- gh-comment-id:989774700 --> @majkinetor commented on GitHub (Dec 9, 2021): Tried on third machine and it worked :)
Author
Owner

@majkinetor commented on GitHub (Dec 9, 2021):

FFS, now it also works on first one...

<!-- gh-comment-id:989776035 --> @majkinetor commented on GitHub (Dec 9, 2021): FFS, now it also works on first one...
Author
Owner

@VShawn commented on GitHub (Dec 9, 2021):

BTW, what is the difference between two .zip files in release ?

I didn't notice there are two zip files. one of them may build by git action.

FFS, now it also works on first one...

WT...F?

what about run as administrator on your 2nd machine?

in fact I didn't touch this part of code in this update

Tried on another machine, different error:

   at Shawn.Utils.OnlyOneAppInstanceHelper.NamedPipeSendMessage(String message) in D:\DemoProject\PRemoteM\PRM.Core\Utils\OnlyOneAppInstanceHelper.cs:line 39
   at PRM.App.OnlyOneAppInstanceCheck() in D:\DemoProject\PRemoteM\PRemoteM\App.xaml.cs:line 90
<!-- gh-comment-id:989780481 --> @VShawn commented on GitHub (Dec 9, 2021): > BTW, what is the difference between two .zip files in release ? I didn't notice there are two zip files. one of them may build by git action. > FFS, now it also works on first one... WT...F? what about `run as administrator` on your 2nd machine? in fact I didn't touch this part of code in this update ``` Tried on another machine, different error: at Shawn.Utils.OnlyOneAppInstanceHelper.NamedPipeSendMessage(String message) in D:\DemoProject\PRemoteM\PRM.Core\Utils\OnlyOneAppInstanceHelper.cs:line 39 at PRM.App.OnlyOneAppInstanceCheck() in D:\DemoProject\PRemoteM\PRemoteM\App.xaml.cs:line 90 ```
Author
Owner

@majkinetor commented on GitHub (Dec 9, 2021):

It works as administrator.

Then it started to work without administrator after 1 run with administrator.

<!-- gh-comment-id:989838921 --> @majkinetor commented on GitHub (Dec 9, 2021): It works as administrator. Then it started to work without administrator after 1 run with administrator.
Author
Owner

@VShawn commented on GitHub (Dec 10, 2021):

next time check the access permissions at startup

<!-- gh-comment-id:990743895 --> @VShawn commented on GitHub (Dec 10, 2021): next time check the access permissions at startup
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/1Remote#143
No description provided.