Custom control casting exception during DesignTime but not RunTime - windows-runtime

Been dealing with a casting exception during design time only that getting me nuts.
I'm trying to create a custom control for winRT (a week view control just like windows phone 8.1). The control works fine during run time but in design time it gives me COMException. During my investigation of the cause of this COMException, I found out that there is a casting exception inside one of the component of my control. This component is a custom listview that implement ContainerContentChanging event. Inside this event there is a casting which raises this exception.
Here is a the custom list view class:-
The code is removed coz the source code is shared below.
The TemplatedListViewEntry cctor look like this one:-
The code is removed coz the source code is shared below.
And the AppointmentModel:-
The code is removed coz the source code is shared below.
OBS!!! while debugging using 2 instance of VS or VS+Blend and put a breakpoint before this line I can see that args.Item is of type ContentControl while during run time it is AppointmentModel.
Could it be a problem with the ItemsSource which is null at design time?
If yes how should I preceed and assign this_ If No, anyone here that can help me figure out what is the problem?
OBS!!! I anyone needs more info please ask and I would gladly share the entire code with you.
Edit 1
Even if i initiate my viewmodel in the cctor of the custom Control, it raises casting exception in Designtime and not in Run tim
Edit 2
After i wrote Edit 1 above i noticed that now i have to Cast exception in two different Styles (CustomWeekView style and TemplatedListView Style) this is if you open Generic.xaml inside Blend. It is really getting annoying and i'm out of thoughts now. That is why i decided to share the source code of this Project, hopfully someone will be able to help looking at it. Below you will see the source code.
CustomWeekView

Related

How to Simulate a Keyboard Event in Dart HTML

1. Problem and Context
I'm trying to create a browser extension with Dart, more specifically, one that deals with adding keyboard shortcuts to certain websites.
To guarantee better TDD, I'm trying to simulate keyboard events during the tests. However, it seems like many things have changed when it comes to Dart's HTML APIs and I haven't been able to figure out how to make them work.
2. What I'm Trying
I would like to register a specific keystroke — so the generic KeyboardEvent won't cut it apparently, only the KeyEvent class can handle that. So far, I'm trying something like this:
document.body.dispatchEvent(KeyEvent('keypress', keyCode: 65, charCode: 97));
From which I receive an error close to this:
Error: Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1 is not of type 'Event'.
I've also tried the code above with document, document.window and window, none worked. Something similar can be found in the KeyEvent documentation. However, they mention adding to a Stream, which I don't think is possible. It would have to be a Sink instead.
If I'm not able to solve this via dispatching events, I think I'll have to simply inject mocks into the tests.
3. More Resources
2 outdated answers which have helped me so far were:
dart how to create, listen, and emits custom event?
How do I listen for custom events in Dart?

AS3 - Catch ANY Error thrown and keep track of them?

I would like to have many devices testing a game, and I find the best way to debug a game and solve specific code problems is to have the device connected and in debug mode in Adobe ANIMATE, that way I can catch any Errors in the Output window.
For Example, if I am debugging and connected to Animate, the output window will throw errors like :
ReferenceError: Error #1065: Variable bg_storage is not defined.
at global/flash.utils::getDefinitionByName()
at Game/stageAdd()[/Users/**/Game.as:360]
Now I know exactly what the problem is and where to find it. I love errors like this.
My question :
If I didn't have a device connected to Animate in Debugging mode, is there a way to make the game detect any errors thrown and store them as a String, that way I can put up a big text block on the game of the error string and keep track.
or at least a way to log them some how?
Ex :
If an error is thrown, have that error text set as a String variable, then have a text box write out that String variable.
I hope that isn't too confusing. If I am going about debugging in a poor way, I would love to know what you guys do to keep track of errors without being connected to debug mode.
EDIT
I can see an approach is you to add an uncaughtErrorEvent event to each function to be able to catch these errors...
loadbar.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR ... )
I am trying to make it so any error thrown in any part of the game will trace that error somewhere to a String value that I can call, so that I can see any error thrown during a play test session without being connected to debug mode.
Thanks!
Sure. There's a class intended exactly for that: https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/UncaughtErrorEvent.html See examples at the bottom of the page to listen to the right instances for that event.
You are also free go grab my own class that does the thing you want: https://bitbucket.org/thydmitry/ru.delimiter/src/2756fadd741a6d44276fde1701470daf24cebfa8/classes/ru/delimiter/utils/Log.as?at=default&fileviewer=file-view-default
You will need to add it to your project and then call in the main document class (in constructor, preferably):
Log.create(this);
Log.handleExceptions(this, true);

CODED UI TESTS: is there a way to add a warning in html report?

In my Coded UI Test project, I need to check if few Labels or Messages are consistent with the context. But those checks are not critical if not consistent and I need to output them only as warnings.
Note that I'm using nested ordered tests to use only one global ordered test with vstest.console.exe and get in one shot the overall test coverage report.
Till now I was creating assertions to check those consistencies, but an assertion failure leads to Test failure, then to ordered test failure and then to playback stop.
I tried to change Playback.PlaybackSettings.ContinueOnError value before and after the assertion: this works as I expect as the assertion is well reported as a warning in the html report file. But whatever, it causes the ordered test to stop and then my global ordered test chaining to fail...
I tried to use TestContext.WriteLine too instead of creating assert, but it seems that this is not output in the html report.
So my question is:
is there any way to create an assertion only as a Warning that will be output in the html report file and that doesn't lead to a test failure?
Thanks a lot for any answer and help on this ;)
So I got my solution with developping my own Warning Engine to integrate Warnings in test report, 'cause I found no existing solution for that with the current Coded UI Test Assertion engine.
I'll try to take some time to post generic parts of the code structure with comments translated in english (we're french so default comments are french for now...), but here are the main step lines :
Create a template based on the UITestActionLog.html original file
report structure of Coded UI Test engine, with only the start
bloc and the javascript functions and CSS declarations in it.
Create an assertion class with a main function to manage insertion
of Warning html bloc in the html report first created from the template.
Then create custom assert functions to call the main function
whereever on runtime, and custom Stopwatch to inject elapsed time in
the report ('cause I could'nt found a way to get back the elapsed
time directly from the Coded UI Test engine).
That's it.
Just a proposition as a way to do it, maybe not the best one but it worked for me. I'll try to take time to put blocl codes to be clearer on it.

libc++abi.dylib: terminate_handler unexpectedly threw an exception - 0 stack trace iOS7 / iOS 8

Randomly (that's why I ask the question), my application crashes when want to display data into textView.
The only error message I've got in my debug console is :
libc++abi.dylib: terminate_handler unexpectedly threw an exception
I Googled but can't get a clue to find how correct this and how this happens.
I got the same error and a "clean" didn't resolve it.
It was caused by my internet testing flow, I check to see if WiFi is connected but not if that WiFi has an active internet connection that can resolve a supplied URL. It performs a dataWithContentsOfURL: that will ultimately fail. A similar thread made this suggestion to this question here by user Keith that helped me identify the problem -- which was to add breakpoints to C++ exceptions.
To enable -- click your breakpoints view and the very bottom click the '+' to add a breakpoint. Set it up as follows and the stack trance will be more meaningful.
Clean the project.
Check each constraints and remove the corrupted one.
Clean project again, it should works.
This can be caused by an outlet that is no longer existing (might have been renamed or removed).
Here is a tip on how to check outlets:
Select the container view of the suspected outlet, pay attention to "!" marks in the connections inspector.
I got this question ,because I set [self addObserver:self forKeyPath:#"_defaultAgType" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil];, but I did not remove it in dealloc. I solved this by [self removeObserver:self forKeyPath:#"_defaultAgType"]; in dealloc function.
Another reason why it could happen is when you have a UI element declared but never added to the screen but still you try to do changes on them.
In my case I had a UIBarButtonItem declared in the code but I never added it to View. When I try to remove it without adding it, I had this issue.
If you renamed/moved your view controller class, make sure you've checked Inherit Module From Target on Identity inspector for your scene on the storyboard

Is better Razor diagnostics change now included in ServiceStack v3.9.45?

As I'm still getting HttpCompilationException (External Exception) when I work through Mono on Mac with no hint as to what the real error is within Razor. To test it I'm binding to an invalid property name in a model. If I use the correct property name it works.
The project has GitHub issue here: https://github.com/ServiceStack/ServiceStack/pull/561
Is this change now included in v3.9.45? Do I have to do anything extra to enable it? I've got DebugMode on but that just adds stack trace data.
The Razor support was rewritten and my original change to improve the debugging experience wasn't carried forward (originally). It's now been added, see this comment:
https://github.com/ServiceStack/ServiceStack/pull/561#issuecomment-18204358
And this is the pull request that added it.
https://github.com/ServiceStack/ServiceStack/pull/684
It was included as of 3.9.47