I created a new Connector Solution Project.
During implentation I wanted to call the function (GetParameters) and there is a problem with the DLL import for my QAction.
"QAction 206"
object[] oReturnValues = (object[])protocol.GetParameters(
new UInt32[] {
Parameter.tokenstatuscodeoperator_205,
Parameter.tokenresponseoperator_206
});
VS Studio can't resolve it. (even the "Paramater.xxxx" is not defined in this contex)
QAction_Helper Parameter Class.
The DLL import is not imported, so I tried to import it. As you can see, even I try to import it is gonna unchecked after checking the import.
How can I import the DLL?
Thank you in advance.
Hi Ömer,
For the code that you are showing no DLL references are needed. The Parameter class also seems to be generated correctly by DIS, so at first sight everything seems correct. Maybe doublecheck if you have a using statement with "Skyline.DataMiner.Scripting" at the top of your file.
If above doesn't help it would be very helpful to see the exact error message that you get.
I added a “new answer” with an image.
Additionally, I installed the v4.8
after click on the fix button, this error message appears:
System.InvalidOperationException:
Message="Can't set the value of a read-only property."
Source="Microsoft.VisualStudio.Validation"
StackTrace:
at Microsoft.Verify.FailOperation(String message)
at Microsoft.VisualStudio.ProjectSystem.PropertyPages.PageIntProperty.SetValueAsIntAsync(Nullable`1 value)
at Microsoft.VisualStudio.ProjectSystem.PropertyPages.PageIntProperty.SetValueAsync(Object value)
at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAProperty.<>c__DisplayClass22_0.<<set_Value>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAProject.<>c__DisplayClass73_0.<<Mutate>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.<>c__DisplayClass578_0.<<Mutate>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
at Microsoft.VisualStudio.ProjectSystem.ProjectMultiThreadedService.ExecuteSynchronously(Func`1 asyncAction)
at ProtocolEditorShared.InfoBar.IncorrectTargetFrameworkInfoBar.FixProjectsTargetFramework()
at ProtocolEditorShared.InfoBar.IncorrectTargetFrameworkInfoBar.OnActionItemClicked(IVsInfoBarUIElement infoBarUIElement, IVsInfoBarActionItem actionItem)
at Microsoft.Internal.VisualStudio.PlatformUI.CookieTable`2.ForEach(CookieTableCallback`2 callback, Boolean skipRemoved)
at Microsoft.VisualStudio.Platform.WindowManagement.InfoBar.InfoBarViewModel.NotifyActionItemClicked(IVsInfoBarActionItem action)
at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
at System.Windows.Documents.Hyperlink.OnClick()
at System.Windows.Documents.Hyperlink.DoUserInitiatedNavigation(Object sender)
at System.Windows.Documents.Hyperlink.OnMouseLeftButtonUp(Object sender, MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.ContentElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
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)
I translated it with Google translator cause my VS Studio is in my native language
seems there are some packets missing ?
Hi Ömer, some of the QAction projects are targeting .NET Framework 4.8 while others are targetting .NET Framework 4.6. A project cannot have a reference to another project that targets a higher .NET version. That’s the reason why your solution doesn’t build. The following link explains how to change the target version of a project: https://learn.microsoft.com/en-us/visualstudio/ide/visual-studio-multi-targeting-overview?view=vs-2022#change-the-target-framework.
thank you for this introduction
sadly the “application-menu” is not exist by me
but i found another way to fix, after try to fixing it there is a new error message.
I will upload again an image
As u can the its not hightlight correctly and the auto completion is not showing any function "GetParameters"
Hi Ömer, do you see any errors in the Error List of Visual Studio after doing a “Rebuild All”? Have you already tried to restart Visual Studio?
I added the picture of the error messages
Hi Ömer
You don't need the 'SLProtocolScripts.dll' for the GetParameter and the Parameter classes.
As you are working in a connector solution, you can create the QAction project by pressing the icon to the left of the QAction tag (Edit QAction option in the menu seen in your gif). This will generate the QAction project with the necessary references and NuGet packages.
Then on the solution, make sure you used the 'Restore NuGet packages' option and see if Visual Studio can build the solution.
Thank you for your fast answer.
this is my QAction:
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using Skyline.DataMiner.Scripting;
///
/// DataMiner QAction Class: Create Token.
///
public static class QAction
{
///
/// The QAction entry point.
///
/// Link with SLProtocol process.
public static void Run(SLProtocol protocol)
{
try
{
object[] oReturnValues = (object[])protocol.GetParameters(
new UInt32[]
{
Parameter.tokenstatuscodeoperator_205,
Parameter.tokenresponseoperator_206
});
}
catch (Exception ex)
{
protocol.Log($”QA{protocol.QActionID}|{protocol.GetTriggerParameter()}|Run|Exception thrown:{Environment.NewLine}{ex}”, LogType.Error, LogLevel.NoLogging);
}
}
}
the auto complete is not working and the highlighting
I can’t add the picture in the comment, I will add it in the question: as an answer
I have my code and an example code and the highlighting works well in the example and the auto complete