PlatformNotSupportedException
Using ServiceController on a script I was using on LP5, but now on 7 and I get this:
"ServiceController enables manipulating and accessing Windows services and it is not applicable for other operating systems"
I know ServiceController is Windows-only. Why does LinqPad not know this?
Comments
It runs fine in interactive LinqPad, but not when running from the command line with lprun7.exe Any idea why it would act two different ways?
How are you importing the System.ServiceProcess.ServiceController library? NuGet package?
Can you press F4, Advanced, click Show Assembly Resolution Log and share the output.
Also, run the following query from both the LINQPad GUI and LPRun7:
typeof (ServiceController).Assembly.Location.Dump();
Here is the result of typeof (ServiceController).Assembly.Location.Dump()
From the command line using lprun7.exe:
C:\Users\Administrator.nuget\packages\System.ServiceProcess.ServiceController\7.0.0\lib\netstandard2.0\System.ServiceProcess.ServiceController.dll
From the gui: C:\Users\Administrator.nuget\packages\System.ServiceProcess.ServiceController\7.0.0\runtimes\win\lib\net7.0\System.ServiceProcess.ServiceController.dll
So command line runs .net standard? It really should be from the win runtime folder. How is this determined? Wht does one behave differently? Isn't all information needed stored in the .linq file?
Linqpad version: 7.5.15
I just uninstalled versions 5 and 6 and reinstalled 7. No luck.
There's a subtle issue in 7.5.15 that could potentially lead to this. I'm going to push out 7.5.16 to remaining users - can you re-start and tell me whether there's a still a problem after the update? Note that you may have to use the -recompile option when first calling LPRun7.