Editing in Telerik RadGrid - ajax

I'm working off of the following example to implement editing of a cell in my grid when the cell is clicked:
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/editondblclick/defaultcs.aspx
I'd like it to work just like in the example, but based on a single-click. I can't get it to work as I keep getting the following error buried away in Telerik.Web.UI.WebResource:
0x800a139e - Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: The string was not recognized as a valid format.
If anyone can lend any assistance, I will you owe you my first-born, as I am pulling my hair out trying to get this to work.
Thank you
Initially, the error was here but it didn't seem essential:
protected void detailsGrid_ItemCreated(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem && e.Item.IsInEditMode)
{
((e.Item as GridDataItem)["detailsGridMonthOneCol"].Controls[0] as RadNumericTextBox).Width = Unit.Pixel(50); // ArgumentOutOfRangeException - Specified argument was out of the range of valid values
}
}
detailsGridMonthOneCol is the name of the column I double-clicked. This didn't seem essential, so I commented it out and that's when I got the following error:
Unhandled exception at line 15, column 16485 in http://localhost:63919/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=;;System.Web.Extensions,+Version=4.0.0.0,+Culture=neutral,+PublicKeyToken=31bf3856ad364e35:en-US:10a773fc-9022-49ec-acd6-8830962d8cbb:ea597d4b:b25378d2;Telerik.Web.UI,+Version=2012.2.815.40,+Culture=neutral,+PublicKeyToken=121fae78165ba3d4:en-US:bd12f06c-2391-4523-868e-0017245d9792:16e4e7cd:ed16cbdc:f7645509:24ee1bba:e330518b:1e771326:8e6f0d33:6a6d718d:58366029:4b09f651:a2c5be80:874f8ea2:c172ae1e:f46195d3:9cdfc6e7:2003d0b8:c8618e41:e4f8f289
0x800a139e - Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: The string was not recognized as a valid format.
The code is buried away but here's where the exception gets thrown:
var e=this._get_eventHandlerList().getHandler("endRequest"),b=false;if(e){var c=new Sys.WebForms.EndRequestEventArgs(a,f?f.dataItems:{},d);e(this,c);b=c.get_errorHandled()}if(a&&!b)throw a}

In your Script Manager add a handler to the OnAsyncPostBackError="myScriptManager_AsyncPostBackError" and in code behind just put one breakpoint on the open curly brace of the method.
protected void myScriptManager_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e)
{ // breakpoint this line.
}
doing this, probaly, this breakpoint will be hit and you could debug your code, and inspect who was thwrowing the exception.
This can help, but, the only way to help you, in fact, is if you provide the full source code. I suggest you to create another project, isolate the code that you want to work, and publish this code on github, ftp, etc.
Please, post your code and i will help.

The code is not really buried away. Javascript is showing you this error. However. the error is happening on the server side (Sys.WebForms.PageRequestManagerServerErrorException)
Check the Event Viewer (start => Run => eventvwr) it will show you more details of the error.

Related

Hitting exception when using Google Protobuf Any UnpackTo function in C++

google::protobuf::Any anyResponse = someResponse.response();
ResponseType unpackResp; //ResponseType is a subclass of google::protobuf::Message
if (anyResponse.UnpackTo(&unpackResp))
{
...
}
Running this piece of C++ code and access vialotion exception happens in anyResponse.UnpackTo(&unpackResp). Does someone know how to debug into this function? I checked anyResponse and it looks good.
It went through these files in google::protobuf:
call stack
Anyway I can see these files?

Visual Studio - inject hard coded number / identifier in to code

Is something along these lines possible?
Using Visual Studio (and it's kind of language agnostic I guess but I am using C#), precompiling, I would like to somehow inject and replace values with a unique ID (or number is fine!).
E.g.
public void HelloWorld (
{
{VARIABLE_FOR_UNIQUE_ID_REPLACED_AT_COMPILE_TIME}
var someVar = "Error Code#";
console.print(someVar + {VARIABLE_FOR_UNIQUE_ID_REPLACED_AT_COMPILE_TIME})
}
So for every function, I will have {VARIABLE_FOR_UNIQUE_ID_REPLACED_AT_COMPILE_TIME} and it will be a unique ID to that function, in every file, throughout the solution.
It doesn't need to be anything complicated like a GUID, ideally it is just an incremental number when added but does not change after adding. This number is used to identify the function for Error Codes - so I can track where the error derived from even though the message is a generic "something went wrong", e.g. "Error Code #445 something went wrong", "Error Code #6778 something went wrong".
I think you should manage that yourself.
Think about it:
If you get error reports in saying "Error Code #445 something went wrong" then first thing you will want to do is search your code base for "445" to find the originating code - but you won't find anything with the scheme you are describing since the actual source of the error will just say {VARIABLE_FOR_UNIQUE_ID_REPLACED_AT_COMPILE_TIME}.
If on the other hand you just manage it yourself and write something like:
int errorCode = 445;
...and always keep that same pattern in your code, then in a debug situation where you need to find 445 you can actually search your code base for 445 and find the place where the error is coming from.
In C# you can get the method name from code for example like this:
public void HelloWorld()
{
ShowError();
}
static void ShowError([System.Runtime.CompilerServices.CallerMemberName] string caller = null)
{
Console.WriteLine("Error Code for " + caller);
}
It will print: "Error Code for HelloWorld".

When running a Unity HoloLens program from Visual Studio, when an exception is thrown how do I get the line numbers in the stack trace?

Currently when an exception is thrown from within my Unity script while using my HoloLens the Debug Output in Visual Studio shows the stack trace without the line numbers.
How do I get the line numbers along with the stack trace? I'd be fine with it being logged somewhere else other than the Debug Output.
Here's some example output in Visual Studio:
Exception thrown: 'System.NullReferenceException' in Assembly-CSharp.dll
NullReferenceException: Object reference not set to an instance of an object.
at NewBehaviourScript.Update()
at NewBehaviourScript.$Invoke6Update(Int64 instance, Int64* args)
at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)
(Filename: <Unknown> Line: 0)
And the corresponding Unity script (I made a Cube and attached a NewBehaviourScript component):
public class NewBehaviourScript : MonoBehaviour {
// Update is called once per frame
void Update ()
{
object a = null;
a.GetType();
}
}
I tried changing the build from Release to Debug doesn't give the line numbers.
I tried googling, and it looks like it's not showing the line numbers for others, as well: http://answers.unity3d.com/questions/1315985/null-reference-in-line-0.html
I tried asking on Microsoft's forums, but didn't receive any useful replies.
I don't think you would get the line number since it does not exist anymore. You get it in Unity editor because you are not running a full build of the application so Unity still has access to the non-compiled code. When you run on the device, it sends debug commands to the VS console about the printing and the errors but all the code is binary at that point, so there is no reason nor possibility to provide a line number.
Actually this is not specific to Hololens, but you would get the same in Android or iOS. Once build, the code is no longer the same, it does not even match one to one as the compiler performs optimizations.
What you can do is placed Debug commands to see where it happens.
public class NewBehaviourScript : MonoBehaviour {
// Update is called once per frame
void Update ()
{
object a = null;
#if DEBUG
if(a == null)
{
Debug.Log("[NewBehaviourScript] Running update with null a object");
}
#endif
a.GetType();
Debug.Log("[NewBeahviourScript] if this line prints, method did not crash");
}
}
In this example, you can use the DEBUG macros if you would have code running only for debug purpose. This way you can easily exclude it on export. The second call for Debug is not required in the macro since the build process will discard it when you set the build to Release or Master.

Espresso Perform Exception happening in CI only

I am using Bitrise to run some Android espresso UI tests, but I cant seem to find a solution for this Perform Exception:
android.support.test.espresso.PerformException: Error performing 'single click' on view 'with id: com.selfcarecatalyst.healthstorylines.adda:id/male'.
at android.support.test.espresso.PerformException$Builder.build(PerformException.java:83)
Im testing a sign up page that has a few fields. If i skip clicking one field, I get the same error on the next click on this form. The relevant code is:
public void clickMale_onInfoPage(){
onView(withId(R.id.male)).perform(click());
}
public void setFirstName_onInfoPage(String name){
onView(withId(R.id.first_name)).perform(typeText(name));
closeSoftKeyboard();
}
setName is called first, and i added a softclosekeyboard thinking this would solve it but it did not :(
This is running through a CI, and sorry but Im a little new and not sure how to get a better error message/stacktrace. Any help would be much appreciated!
You should also try to call closeSoftKeyboard() before performing the click action.

Raising obfuscated events with moq throws error

We have using Moq for two month now. However there is a problem which can not solve somehow.
In visual studio all tests succeeded just fine. On the build server there are several tests which failed. What they have in common is, that they use the "raise" method to throw an event. Our build server tests obfuscated what is good to find obfuscation errors. Every "normal" expectation like "Setup(something).Returns(something)" works. Only the raise event fails. the stacktrace looks like the following:
MESSAGE:
Test method Ade.Graphic.Presenter.Test.RoutingEngineTest.TestRouteOverLadderLinesWithFbd threw exception:
System.ArgumentException: Could not locate event for attach or detach method Void ᜀ(ᦜ[ᢈ]).
+++++++++++++++++++
STACK TRACE:
bei Moq.Extensions.GetEvent[TMock](Action`1 eventExpression, TMock mock)
bei Moq.Mock`1.Raise(Action`1 eventExpression, EventArgs args)
bei Ade.Graphic.Presenter.Test.RoutingEngineTest.TestRouteOverLadderLinesWithFbd()
The code for this is:
documentEventHandler.Raise(stub => stub.DocumentChanged += null,
new DocumentChangeEventArgs(DocumentChangeTypes.ViewUpdate));
We have no idea what is the difference between the code above and this
eventHandler.SetupGet(stub => stub.DocumentChangeNotify).Returns(documentEventHandler.Object);
because this code works fine.
Does anyone had the same problem or at least can tell what the difference is?
The error comes probably (not sure as not tested) from the fact that events (i.e. DocumentChanged) are actually generated as 2 accessors: add_DocumentChanged and remove_DocumentChanged . This is similar to the properties that have the get and set accessors.
What the obfuscator did most probably is rename this add_DocumentChanged and remove_DocumentChanged. However, looking at the moq source code, I can see that moq relies on the events accessor keeping the same name:
var ev = addRemove.DeclaringType.GetEvent(
addRemove.Name.Replace("add_", string.Empty).Replace("remove_", string.Empty));
ev == null in this case, which raises an error.
In your second examples, you're using delegates which are not broken down into add_ and remove_ accessors.
You're probably better off not obfuscating events.

Resources