ExportBatchDVHs.cs issue?
michaelwkudla opened this issue · comments
Hi,
I get the following out of date issue while using ExportBatchDVHs.cs as a plugin (tools>scripts).
I've put "..." to hide my paths and I've hidden my PublicKeyToken. The rest of the trace is below:
.....\Varian-Code-Samples-master\Varian-Code-Samples-master\Eclipse Scripting API\projects\ExportBatchDVHs\ExportBatchDVHs.cs
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> VMS.TPS.Common.Model.ScriptExecutionException: There was a problem while executing the script '...\Varian-Code-Samples-master\Varian-Code-Samples-master\Eclipse Scripting API\projects\ExportBatchDVHs\ExportBatchDVHs.cs' (ESAPI: VMS.TPS.Common.Model.API, Version=1.0.300.11, Culture=neutral, PublicKeyToken=). ---> System.ApplicationException: ....\Varian-Code-Samples-master\Varian-Code-Samples-master\Eclipse Scripting API\projects\ExportBatchDVHs\ExportBatchDVHs.cs(42,42) : warning CS0618: 'VMS.TPS.Common.Model.API.Application.CreateApplication(string, string)' is obsolete: 'Eclipse Scripting API Application executes using the currently logged in Windows user credentials. The given username and password are ignored.'
at VMS.TPS.Script.Engine.CompileAssembly(String fileName, Boolean extendedForVisualScripting)
at VMS.TPS.Script.Engine.LoadScript(Assembly& assembly, IApplicationScriptExecutionGuard& executionGuard, String& generatedCodeFilename, String filename)
at VMS.TPS.Script.Engine.Execute(String fileName)
--- End of inner exception stack trace ---
at VMS.TPS.Script.Engine.Execute(String fileName)
at VMS.TPS.Script.Extension.Execute(IntPtr parentWindow)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at vhost.TpsNetExtension.Execute(TpsNetExtension* , HWND__* parentWindowHandle)
Any help would be greatly appreciated!
Hi there.
Your problem is likely caused by
using (Application app = Application.CreateApplication(null, null))
{
Execute(app);
}
Use CreateApplication() instead. Newer versions of Eclipse use Windows credentials. So you need to be logged on to windows, and ESAPi will use those credentials automatically.
Ok, thank you, I will try this. If successful, I can make a PR to check the windows version and use the appropriate command if that's helpful?