Linqpad 5 UnauthorizedAccessException when calling Cop.AsFluent()

Issue #7 closed
Duane McKinney created an issue

I am not sure if this is just a misconfiguration on my machine or something else. It works in Linqpad4, but not Linqpad 5.

UnauthorizedAccessException4 Access to the path 'EasyHook32.dll' is denied.

StackTrace: at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound) at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost) at System.IO.Directory.Delete(String path, Boolean recursive) at ModuleInitializer.ExtractResources() at CodeCop.Core.Cop.AsFluent(String licenseKey) at UserQuery.Main() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()

You need the paid version of linqpad in order to use NuGet. So it is understandable if this is out of the scope.

Steps to reproduce: 1. Select c# program as the language type.

  1. Add CodeCop 1.2.6 NuGet Package

  2. Add namespaces

  • CodeCop.Core

  • CodeCop.Core.Fluent

  1. Add code below.

  2. Run query.

Here is the code I am trying to run. void Main() { Cop.AsFluent(); Cop.Intercept();

  typeof(Test).GetMethods().Dump();

  var test = new Test();
  test.Name = "Joe";
  test.Greet("Bob");
}

// Define other methods and classes here
public class Test
{
  public string Name { get; set; }
  public void Greet(string other)
  {
    $"Hello {other}, I'm {Name}".Dump();
  }
}

Comments (3)

  1. Duane McKinney reporter

    It turns out that this was because I had both Linqpad 4 and Linqpad 5 open. Once I closed Linqpad 4, everything was working. I did try to run multiple instances of an executable that I created which were using CodeCop and I did not have any issues.

  2. Log in to comment