SageFormIntegration.ProcessRequest - Object Reference not set - .NET - opayo

I'm getting and object reference not set error on the following code.
Line 28: public IFormPayment ProcessRequest(IFormPayment formPayment)
Line 29: {
Line 30: RequestQueryString = BuildQueryString(ConvertSagePayMessageToNameValueCollection(ProtocolMessage.FORM_PAYMENT, typeof(IFormPayment), formPayment,SagePaySettings.ProtocolVersion));
Line 31:
Line 32: formPayment.Crypt = Cryptography.EncryptAndEncode(RequestQueryString, SagePaySettings.EncryptionPassword);
Stack Trace
[NullReferenceException: Object reference not set to an instance of an object.]
SagePay.IntegrationKit.SagePayIntegration.GetPropertyTextValue(Object request, String propertyName) in C:\dev\dotnet\VspDotNetKitAPI\SagePayIntegration.cs:93
SagePay.IntegrationKit.SagePayIntegration.ConvertSagePayMessageToNameValueCollection(ProtocolMessage protocolMessage, Type type, IMessage message, ProtocolVersion protocolVersion) in C:\dev\dotnet\VspDotNetKitAPI\SagePayIntegration.cs:155
SagePayFormIntegration.ProcessRequest(IFormPayment formPayment) in c:\SagePayKit\App_Code\SagePay\SagePayFormIntegration.cs:30
Form_Default.Page_Load(Object sender, EventArgs e) in c:\SagePayKit\Lockings\Default.aspx.cs:36
System.Web.UI.Control.LoadRecursive() +70
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3177
Probably something really obvious I am missing here but I've been looking at it for some time and comparing it to the integration kits version, which works fine, and connect see where I am going wrong.
Any help would be appreciated.
Thanks.

Related

Coded UI - The playback failed to find the control with the given search properties

I am trying to run recorded test cases and its giving me this error :(
I am not able to understand this.
Please help.
Test Name: CodedUITestMethod1
Test FullName: CanopusCodedUITestProject.CodedUITest1.CodedUITestMethod1
Test Source: d:\CanopusDev\Main\Source\Solutions\CanopusCodedUITestProject\CodedUITest1.cs : line 30
Test Outcome: Failed
Test Duration: 0:00:23.5295373
Result Message:
Test method CanopusCodedUITestProject.CodedUITest1.CodedUITestMethod1 threw exception:
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException: The playback failed to find the control with the given search properties. Additional Details:
TechnologyName: 'UIA'
FrameworkId: 'Wpf'
ControlType: 'Window'
Name: 'C5K Setup'
ClassName: 'HwndWrapper'
---> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
Result StackTrace:
at Microsoft.VisualStudio.TestTools.UITest.Playback.Engine.IRPFPlayback.FindAllScreenElements(IScreenElement pScreenElementStart, String bstrQueryId, Object& pvarResKeys, Int32 cResKeys, Int32 nMaxDepth, Object[]& foundDescendants)
at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindTopLevelWindowHelper(String queryId)
at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindFromPartialQueryId(String queryId, Boolean resetSkipStep)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl..ctor(String queryId)
--- End of inner exception stack trace ---
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapControlNotFoundException(COMException ex, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowComException(COMException innerException, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(SystemException exception, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(SystemException exception, String queryId)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl..ctor(String queryId)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.SearchTopLevelWindow(ISearchArgument topLevelSearchArg, String topLevelElementQueryId)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetTitleUpdatedTopLevelWindow(ISearchArgument topLevelSearchArg, String queryId, IList`1 windowTitles)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetTopLevelElement(Boolean useCache, Boolean useCacheOnly, ISearchArgument searchArg, IList`1 windowTitles, Int32& timeLeft)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetElement(Boolean useCache, ISearchArgument searchArg)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.Search(ISearchArgument searchArg)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindInternal()
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.<Find>b__3a()
at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.Find()
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.GetPropertyPrivate(String propertyName)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.<>c__DisplayClass3e.<GetProperty>b__3d()
at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.GetProperty(String propertyName)
at Microsoft.VisualStudio.TestTools.UITesting.ALUtility.GetTechElementFromUITestControl(UITestControl uiTestControl)
at Microsoft.VisualStudio.TestTools.UITesting.ActionExecutorManager.GetActionExecutor(UITestControl uiControl)
at Microsoft.VisualStudio.TestTools.UITesting.Mouse.ClickImplementation(UITestControl control, MouseButtons button, ModifierKeys modifierKeys, Point relativeCoordinate)
at Microsoft.VisualStudio.TestTools.UITesting.Mouse.<>c__DisplayClass6.<Click>b__5()
at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
at Microsoft.VisualStudio.TestTools.UITesting.Mouse.Click(UITestControl control, MouseButtons button, ModifierKeys modifierKeys, Point relativeCoordinate)
at Microsoft.VisualStudio.TestTools.UITesting.Mouse.Click(UITestControl control, Point relativeCoordinate)
at CanopusCodedUITestProject.UIMap.CreateConfiguration() in d:\CanopusDev\Main\Source\Solutions\CanopusCodedUITestProject\UIMap.Designer.cs:line 280
at CanopusCodedUITestProject.CodedUITest1.CodedUITestMethod1() in d:\CanopusDev\Main\Source\Solutions\CanopusCodedUITestProject\CodedUITest1.cs:line 32
Looks like the properties of the UI Component on which you recorded has changed and so it is not able to perform your recorded actions. Verify if the search properties of the component is still the same as when you recorded.
Please look at the line shown below in your stack trace:
Microsoft.VisualStudio.TestTools.UITesting.Mouse.
Click(UITestControl control, Point relativeCoordinate)
This means that the CodedUI is trying to click on a control using a specific point on the screen.
For some reason it is unable to find the control it wants to click. Maybe no button exists on this specific point.
Most probably, the screen resolution of your current display device is different from the screen resolution of the display device you used to record these tests.

Custom TemplateExceptionHandler

I need to change the FreeMarker behavior about processing template&data in case some data are missing.
In missing case I need to let the template unchanged and continue in processing.
Example:
Template:
...
var1 = ${var1}
var2 = ${var2}
...
Data:
var1 = Hello
I need Result after processing:
...
var1 = Hello
var2 = ${var2}
...
My solution is:
class MyTemplateExceptionHandler implements TemplateExceptionHandler {
public void handleTemplateException(TemplateException te, Environment env, java.io.Writer out)
throws TemplateException {
try {
//2nd word on 2nd row is name of missing variable :(
String missingVariable = te.getMessageWithoutStackTop().split("\n")[1].split(" ")[1];
out.write("${" + missingVariable + "}");
} catch (IOException e) {
throw new TemplateException("Failed to print error message. Cause: " + e, env);
}
} }
and using:
...
Configuration cfg = new Configuration();
cfg.setTemplateExceptionHandler(new MyTemplateExceptionHandler());
...
My solution works, but I am not satisfied because of:
1) getting missing variable in handleTemplateException() is horrible. Does exist better way how to get a name of missing variable?
2) Even if I have my own TemplateExceptionHandler, FreeMarker writes enough information to output. Can I change it?
Example output for missing variable "environment_name":
22.10.2014 9:01:55 freemarker.log._JDK14LoggerFactory$JDK14Logger error
SEVERE: Error executing FreeMarker template
FreeMarker template error:
The following has evaluated to null or missing:
==> environment_name [in template "Osb-PrepareAndDeploy.ftl" at line 33, column 33]
Tip: If the failing expression is known to be legally null/missing, either specify a default value with myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthessis: (myOptionVar.foo)!myDefault, (myOptionVar.foo)??
The failing instruction (FTL stack trace):
----------
==> ${environment_name} [in template "Osb-PrepareAndDeploy.ftl" at line 33, column 31]
----------
Java stack trace (for programmers):
----------
freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...]
at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:98)
at freemarker.core.EvalUtil.coerceModelToString(EvalUtil.java:382)
at freemarker.core.Expression.evalAndCoerceToString(Expression.java:115)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.MixedContent.accept(MixedContent.java:93)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.Environment.process(Environment.java:243)
at freemarker.template.Template.process(Template.java:277)
at net.homecredit.scm.jenkinsTool.countrySettings.Country.createJobs(Country.java:282)
at net.homecredit.scm.jenkinsTool.Start.main(Start.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
You can't prevent the exception from being logged. TemplateExceptionHandler doesn't mean to make non-error from an error, it just lets you decide what to do after the error has happened. Like, you want to print an error page or something. In extreme case, you may want to continue page rendering after printing some error indicator, but that's still an error that need to be fixed.
Maybe it would help if you tell why do you need this. Maybe the solution isn't TemplateExceptionHandler-s.
As of more intelligent exception processing, first, in the handler you should check if the exception is a InvalidReferenceException, becaue I guess you don't want to deal with others. Then, with getBlamedExpressionString() (requires FreeMarker 2.3.21) you could get part of what you want to print to the output. It's only part of that, because if ${x + 1} fails because x is undefined, it will only return "x", not "x + 1".

Java.Lang.ClassNotFoundException: com.tridion.broker.querying.Query

I am trying to contact tridion content broker database to get published contents using Tridion.contentDelivery dll. When i tried executing the application i am getting the below exception.
Please help
Exception Details: Java.Lang.ClassNotFoundException: com.tridion.broker.querying.Query
Source Error:
Line 107:
Line 108: LoggerService.Debug("GetContentByUrl: about to create query", LoggingCategory.Performance);
Line 109: Query pageQuery = new Query();
Line 110: LoggerService.Debug("GetContentByUrl: created query", LoggingCategory.Performance);
Line 111: ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere
Source File: C:\MyProjects\DD4T\dotnet\DD4T.Providers.SDLTridion2011sp1\TridionPageProvider.cs Line: 109
Stack Trace:
[ClassNotFoundException: com.tridion.broker.querying.Query]
Codemesh.JuggerNET.NTypeValue.Throw(Int64 inst) +574
Codemesh.JuggerNET.JavaClass.ThrowTypedException(Int64 inst) +1361
Codemesh.JuggerNET.JavaClass.init() +390
Codemesh.JuggerNET.JavaClass.get_JObject() +51
Codemesh.JuggerNET.JavaMethod.init() +1652
Codemesh.JuggerNET.JavaMethod.get_MethodPtr() +61
Codemesh.JuggerNET.JavaMethod.get_Handle() +80
Codemesh.JuggerNET.JavaMethod.CallObject(JavaProxy jpo) +493
Com.Tridion.Broker.Querying.Query..ctor() +57
Tridion.ContentDelivery.DynamicContent.Query.Query..ctor() +32
Review the jar files that are located in the lib folder of your application.
There should be a cd_broker.jar there.
You can review that following these installation instructions (for .NET).

The paths Format is not supported exception

I just installed Windowsazure SDK 1.5 and respective tools for Visualstudio 2010. But when i run the compute emulator it gives me the following exception:
Encountered an unexpected error The given path's format is not supported. at
System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionA
ccess access, AccessControlActions control, String[] pathListOrig, Boolean check
ForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess
access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
at System.IO.Path.GetFullPath(String path)
at Microsoft.ServiceHosting.Tools.Utility.SDKPaths.get_CSRunStateDirectory()
at Microsoft.ServiceHosting.Tools.DevelopmentFabric.DevFabric..ctor()
at Microsoft.ServiceHosting.Tools.CloudServiceRun.DoActions.get_DF()
at Microsoft.ServiceHosting.Tools.CloudServiceRun.DoActions.DevFabric(DFComma
nds acts)
at Microsoft.ServiceHosting.Tools.CloudServiceRun.DoActions.ParseArguments(St
ring[] args, Boolean doActions)
at Microsoft.ServiceHosting.Tools.CloudServiceRun.DoActions.ExecuteActions(St
ring[] args).
What is the fix for this weird exception?
I fixed it. The problem was I had an environment variable that has some invalid location and when trying to parse compute emulator is failed.

Problem with fsharpi on Mac OS X: Failed to install ctrl-c handler - Ctrl-C handling will not be available

I have installed mono 2.8.1 using the package installer from mono-project.com and the f sharp libs/bins from http://fsxplat.codeplex.com/releases/view/55463.
When I run fsharpi from the Terminal, I get the following back:
Microsoft (R) F# 2.0 Interactive build
2.0.0.0 Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;
Failed to install ctrl-c handler - Ctrl-C handling will not be available. Error was: Exception has been thrown by the target of an invocation.
Sad times, I have tried running mono --verbose /usr/lib/fsharp/fsi.exe but I can't see anything helpful in the logs....
Method System.MulticastDelegate:Equals (object) emitted at 0x4714c78 to 0x4714d0a (code length 146) [fsi.exe]
converting method (wrapper managed-to-native) Mono.Unix.Native.Stdlib:sys_signal (int,Mono.Unix.Native.SignalHandler)
Method (wrapper managed-to-native) Mono.Unix.Native.Stdlib:sys_signal (int,Mono.Unix.Native.SignalHandler) emitted at 0x4714d10 to 0x4714d89 (code length 121) [fsi.exe]
converting method System.Reflection.TargetInvocationException:.ctor (System.Exception)
Method System.Reflection.TargetInvocationException:.ctor (System.Exception) emitted at 0x4714d90 to 0x4714dae (code length 30) [fsi.exe]
converting method System.ApplicationException:.ctor (string,System.Exception)
Method System.ApplicationException:.ctor (string,System.Exception) emitted at 0x4714dc0 to 0x4714de6 (code length 38) [fsi.exe]
converting method System.Exception:.ctor (string,System.Exception)
Method System.Exception:.ctor (string,System.Exception) emitted at 0x4714df8 to 0x4714e16 (code length 30) [fsi.exe]
converting method System.Exception:get_Message ()
Method System.Exception:get_Message () emitted at 0x4714e18 to 0x4714e52 (code length 58) [fsi.exe]
converting method FSIstrings.SR:fsiCouldNotInstallCtrlCHandler (string)
Method FSIstrings.SR:fsiCouldNotInstallCtrlCHandler (string) emitted at 0x4714e60 to 0x4714ed8 (code length 120) [fsi.exe]
converting method <StartupCode$Fsi>.$FSIstrings/fsiCouldNotInstallCtrlCHandler#222:Invoke (System.Tuple`2<string, Microsoft.FSharp.Core.PrintfFormat`5<Microsoft.FSharp.Core.FSharpFunc`2<string, string>, Microsoft.FSharp.Core.Unit, string, string, string>>)
Method <StartupCode$Fsi>.$FSIstrings/fsiCouldNotInstallCtrlCHandler#222:Invoke (System.Tuple`2<string, Microsoft.FSharp.Core.PrintfFormat`5<Microsoft.FSharp.Core.FSharpFunc`2<string, string>, Microsoft.FSharp.Core.Unit, string, string, string>>) emitted at 0x4714ed8 to 0x4714f14 (code length 60) [fsi.exe]
converting method <StartupCode$Fsi>.$FSIstrings/fsiCouldNotInstallCtrlCHandler#222-1:Invoke (string)
Method <StartupCode$Fsi>.$FSIstrings/fsiCouldNotInstallCtrlCHandler#222-1:Invoke (string) emitted at 0x4714f18 to 0x4714f35 (code length 29) [fsi.exe]
converting method System.IO.UnexceptionalStreamWriter:Write (char)
Method System.IO.UnexceptionalStreamWriter:Write (char) emitted at 0x4714f38 to 0x4714f74 (code length 60) [fsi.exe]
Failed to install ctrl-c handler - Ctrl-C handling will not be available. Error was:
Exception has been thrown by the target of an invocation.
I have also tried running with all permutations of --readline- --nologo --gui- with no success :(
Does anyone have any idea why this is happening? What is more infuriating is that this seems to only be affecting me, as a friend of mine installed it fine using the exact same install method. Could MacPorts be affecting my fsharp install?
Thanks in advance for any help!
Cheers
Jan
I bet you should go to this,
https://github.com/fsharp/fsharp
which is the F# for Mono.
The CodePlex one has significant dependency on Windows.

Resources