Is there a bug inside GroupStyle HidesIfEmpty? - debugging

I have a Windows Phone 8.1 WinRT application. I am using SemanticZoom + ListView combination to display a grouped list through a CollectionViewSource. When I remove all items from all the groups (which are ObservableCollections) and start putting the items back to these empty groups the debugger breaks and shows up with "agip.*" something at a point where it reads DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION; This used to happen for a while but now for a reason I do not know my app just exits and debugging stops without any error message; This is why I cannot remember the exact filename.
I have two questions:
1) How can I get the debugger work again i.e. to display that "agip.*" something page and not just silently quit?
2) By trial and error I managed to track down the cause of this by changing
<ListView.GroupStyle><GroupStyle HidesIfEmpty="true"
to <ListView.GroupStyle><GroupStyle HidesIfEmpty="false".
And voila my app works without any problems. Could this be a bug in the WinRT?
PS: I can achieve HidesIfEmpty behaviour by binding group header visibility to .items.count through a converter so that's not an issue here.

Answering your questions
1) How can I get the debugger work again i.e. to display that "agip.*" something page and not just silently quit?
Try this. Open the Exception settings window: menu Debug -> Windows -> Exception settings. Check all the exception categories.
However, I didn't get it to work. It simply breaks with an unhandled win32exceptions, not giving any idea of where did it occur and doesn't give any details on the exception, even when attaching another Visual Studio instance to debug the devenv.exe process with all exceptions handled.
2) By trial and error I managed to track down the cause of this by changing <ListView.GroupStyle><GroupStyle HidesIfEmpty="true" to <ListView.GroupStyle><GroupStyle HidesIfEmpty="false". And voila my app works without any problems. Could this be a bug in the WinRT?
Looks like it is a bug.
Your workaround
I can achieve HidesIfEmpty behaviour by binding group header visibility to .items.count through a converter so that's not an issue here.
This approach doesn't look good on Windows 10, for example, where the group header has a border on the bottom. So hiding the TextBlock doesn't hide the group header completely. (Maybe I'm doing something wrong).
I solved the problem in a different way.
Another workaround
After clearing each group of the grouped collection, try to make a delay. Like this:
foreach(var group in GroupsCollection)
{
group.Clear();
await Delay(1); // this is workaround
group.Add(newItem);
}
This has helped in my case.

Related

Why The application is in break mode?

I swear I used to remember Visual Studio just breaking on an exception. It would take you straight to the line where the exception was thrown and allowed you to inspect variables just by hovering over them.
Or maybe that was a dream. Or maybe this is a nightmare.
But it's actually not a problem, right, because now instead of it just working all you need to do is go to Debug > Windows > Exception Settings where you get this mess.
Which has many glaring problems. For example:
Remember when I said it used to just work?
I don't have all these Exception types memorized.
Clicking toggle all on/off removes your previous selections.
Oh and also, clicking this checkbox does absolutely nothing
It used to just work. Is it possible to get it back to just doing that?
Under exception settings, Go to Common Language Runtime Exceptions->check all. This will not break your application, but show you the exact line of occurrence of the exception.
Per that first image you posted, it appears the application is throwing an exception in "external" code, so you likely have the "Just My Code" enabled in the debugging options. Try unchecking that "Just My Code" option via your Tools|Options dialog (Debugging\General category), and that'll likely fix you up.

Visual studio form editor error

I have an error in my form editor preventing me from modifying the form.
I know in which control this occurs but no way to find what exactly causes the problem.
I tried setting breakpoints in the InitializeComponents() of the form I try to open but it doesn't stop (I am in debug mode...). I also tried to attach using a second instant of Visual Studio as demonstrated here, but even when setting all debug exception options to "throw", the attached process doesn't stop and indicate anything about call stack nor other useful information...
All I know is that there is a disposed object I'm trying to access, but absolutely no information as to where in code, etc..
What could I possibly do to debug the situation - knowing which control is the cause but absolutely no idea as to which of the 300 lines of code causes the issue...

Unable to determine application identity call? How to track down?

I am making a windows phone 8 application and in the designer view in both blend and VS I get "Unable to determine application identity call" error as a dialog box.
From what I read on stack this is propably because of the Isolated Storage is getting run and the designer can't handle it.
I am wondering is there away I can get some line numbers or something where the errors are happening instead of having to manually go through the code?
By the time you see this message box it is already too late, the exception was caught and handled. You have to catch it when the exception is raised. Which is not so easy to do at design time.
One technique that's worth a shot is to use a debugger to debug Visual Studio itself. Start it again and use Tools + Attach to Process. Locate the first devenv.exe in the list of processes and select it. Set the Attach to: setting to "Managed (v4.5, v4.0)" and click OK. Let it trundle to find the PDBs (takes a while). Debug + Exceptions, tick the Thrown checkbox for CLR exceptions.
Switch back to the original instance of VS and do whatever you did before to trigger the error. The 2nd instance will break in when the exception is thrown. Which some luck you'll see your code on the Call Stack window. If the debugger doesn't break then repeat the exercise but attach to XDesProc.exe, the XAML designer. Good luck with it.
Isn't this
Unable to determine application identity of the caller?
or
Getting Unable to determine application identity of the caller Error
are the same topic????
Don't know, just asking...
Sorry for any inconvenience..
Just answered in my basic question.
I'm afraid, i don't know how to get exact string number, just keep in mind that Designer cant have an access to the IsolatedStorage and check all places where you're working with IsolatedStorage. Basically, what you need to do is to add to all constructors a lines
if (ViewModelBase.IsInDesignModeStatic)
return;
If you're working with MVVM Light, or
if (System.ComponentModel.DesignerProperties.IsInDesignTool)
return;
which is pretty the same but without MVVM Light.
Also, i edited my answer there.

How to debug Dojo in browser?

I'm currently (trying) to develop an app with Worklight Studio 5.0.6 and Dojo (Mobile) 1.8.3. I have a really hard time to to find a proper method for debugging. After waiting 5-10 minutes for the build an deploy-process on the server, an error usually looks like this in the Chrome debugger:
How am I supposed to track down this error in MY source? The whole stack trace consists entirely of Dojo code which generates an absolutely useless error message after 20 abstraction layers.
Seriously, how do you guys handle this in real life? What methods do you use for debugging Dojo-driven apps in the browser?
spyro
For dojo.parse errors, I find it useful to pause the Chrome debugger on all exceptions (the purple icon on your screenshot, should be blue). You usally get more details about the cause of the error, the name of the DOM node being parsed, etc. in the first exception being raised.
RĂ©mi.
Debugging dojo based application should be the same as debugging any javascript application.
Usually I will follow these steps:
add console.log() somewhere in code: this is fast and most of time this is enough.
set breakpoint in debugger: if step 1 is not enough, you can base on error information to set breakpoint before error line, then step in or step out.
comment out recently changes: for some error which is hard to find the error line, for example, parse error in your case, the good way is comment out your recently changes one by one till back to your last working version. Or, return to your last working version, then add code back one by one.
Create a simple application to reproduce the error : if your application is very complicate and it is hard for you to follow above methods, you can try to create a new application which mimics your current application but with simple logics and try to reproduce the error.
Based on experience : Some errors, for example, extra ',' in the end of array which works at chrome and firefox, will report a nonsense error information at IE. Debug these kinds of errors is very difficult, you can base on your experience or do a google search.
Did you provide isDebug: true in your dojoConfig? Also, try to see if the same occurs in other browsers.
Update: I recently discovered that there are issues with Google Chrome and Dojo debugging and I think it has to do with the asynchronous loading of files. As you can see in the provided screenshot of #spyro, the ReferenceError object is blank (which you can notice because of the empty brackets {}). If you want to solve that, reopen the console of Google Chrome, (for example by tapping F12 twice). After reopening the ReferenceError should not be empty anymore and now you can expand that object by using the arrow next to it and get a more detailed message about what failed.
Usually what I do in situations like that is to place a breakpoint inside the error callback (line 3398 in your case) and then look into the error variable ("e").
I am not sure how familiar you are with the Web Inspector, but once you hit the breakpoint open the Web Inspector 'console' and check for the error properties "e.message" and "e.stack" (just type in "e.message " in the console).
Also, during development it is better to avoid Dojo optimization / minification, which greatly improve your debug-ability.
Bottom line is to try to place the breakpoint before the error is thrown.

Another knack on the "Dialogs must be user-initiated" Security Exception in Silverlight printing

I get the infamous "Dialogs must be user-initiated" Security Exception when I try to print some stuff in Silverlight. As you can see, the dialog is as user-initiated as can be:
John Papa couldn't help me much out neither, because I don't have any breakpoint set. Mr MSDN thinks it could also be that I'm just taking too long, but this is a demo application just as simple as can be.
Any ideas? I guess it's a Visual Studio quirk, maybe some extensions interfering, as things seems to work when I launch the application outside of it. I first thought maybe the Code Contracts are interfering with their IL weaving, but they are deactivated for this project.
Update: This is just a simple Silverlight application that runs locally from the file system. When I do "Start debugging", Visual Studio creates a hosting HTML file containing the Silverlight app in the Debug resp. Release folder of the project, launches the Internet Explorer with that HTML file and attaches the debugger to it.
Update 2: I also get the same error when I create a web project to host the Silverlight app and create a virtual directory for it on IIS.
I might also want to add that I don't have problems with printing in other Silverlight projects regardless of their hosting scenarios.
Update 3: I downloaded FireFox and it works, I don't get the error when I debug with it. So it seems to have to do with my IE8. I uploaded the solution:
http://dl.dropbox.com/u/10401470/Code/Demos/PrintingDemo.zip
I wonder if anyone can reproduce?
Anyone got an idea to which team I should file a bug report? Silverlight team? IE team? VS Debugger team?
I'm able to reproduce this. You have handled the Click twice, once in XAML another time in code. See your MainPage.xaml
<Button x:Name="PrintButton"
Content="Gotta print 'em!" Margin="8"
Click="PrintButton_Click" />
Don't feel bad about it. I did it last time through a misplaced Print inside a loop.
I've also experienced this strange behaviour. A standard button click event immediately invoking an OpenFileDialog. It would frequently generate the same error when being debugged but would eventually be coaxed in to working when the button is clicked several times.
However when built as a release (or perhaps simply by running the same Xap without a debugger attached to the browser) the problem would go away.
Try to remove
if(SightPaleceListBox.Items.Count > 0)
I had the same problem and found out that the reason was this following line:
cnvsMain.Children.Remove(PrintPagePlaceHolder);
cnvMain is on the page that the user pushed the Print button on (I was trying to remove it from that page in order to add it to the canvas that I was going to print).
My tip: try to comment rows one by one, until you find what row causes the problem. Than try to work around it.

Resources