Dojo treegrid runs fine locally, but not on remote server - datagrid

Using dojo's TreeGrid (v. 1.9.0) served by my local machine (mvc.net) the grid loads fine with my sample, hard-coded data. However, when served from a remote machine, I get the un-debuggable "Sorry, an error occurred".
Breakpoints within my formatters are not even hit, suggesting the problem does not lie with any unloaded dependencies within a formatter. This fails not only on initial startup, but also if at runtime I try to reload the model using .setModel(myNewModel) after everything has definitely loaded. I have the firebug flag set in the dojo config object, and no informative warnings or errors are showing up in firefox...just that annoying and useless message in the grid itself.

The Sorry, an error occurred message is a result of a problem with your store and usually the data you are putting into the store.
The message is shown in DataGrid._onFetchError and TreeGrid mixes in the DataGrid.
You can
put a break point on the query engine of what ever store you are using,
analyze the data being passed into the store

Related

Biztalk scripting functoid failure

In a BizTalk mapping, I use a scripting functoid from an external assembly. The assembly reference is added. When the mapping is used, however, it causes the following error:
'ScriptNS0:DoSomething()' has failed.
Now, this could mean any number of things that's wrong about this scripting functoid. However, even when a try-catch block is placed around the entirety of the C# code and the catch throws a custom exception, a proper new deploy yields the very same error and not the newly added custom one.
This would suggest that the mapping has been started and that something causes an error as soon as it hits the scripting functoid, but without actually performing even the slightest action within the function. When looking at the XSLT of the map, it seemed perfectly fine. The reference to the external assembly has been checked over and over again (and references of this external assembly as well). Everything looks fine and very much like many other mappings I've seen, yet still the outcome is the error above.
I realise this is a rather vague question, but does anyone have a clue what's going on here?
You'll have to test this out in Visual Studio. A few things to keep in mind:
It's very possible that your actual data is causing an exception (it's an edge or corner case that you're not testing for in your console application).
Throwing exceptions in external assemblies doesn't always translate well in an XSLT map, particularly when you do it on a Port. IIRC it's handled slightly more gracefully in an orchestration.
If you can't reproduce this in Visual Studio testing or a unit test, you should be able to attach the Visual Studio debugger to the appropriate BtsNtSvc.exe or BtsNtSvc64.exe (or w3wp.exe if it's running in IIS/isolated host). Set a breakpoint on the entrance to your custom function, step through, see what's going on. If you're only able to reproduce it in a non-dev environment, see if you can set up remote debugging - but you may be better off enhancing the logging on the functoid in that case and redeploying if possible.
In general, I always try to do the following in custom functoid scripts:
Avoid throwing exceptions - use methods like TryParse rather than Parse, and on failure to parse return an error string or an empty string or the original string (depending on requirements/tolerance of destination system) rather than throwing an exception. If you do throw an exception, it's unlikely to be handled gracefully and unlikely that the exception type or text will make it back to a user/administrator.
Do error logging in these scenarios instead - generally using the Windows Event Log (System.Diagnostics.EventLog.WriteEntry). Make sure to use a properly registered event source, ideally one that matches your application name and is registered by your installation process, but at least one that exists on the computer to avoid throwing another nonsensical exception! This will allow developers/admins faster insight into what's going on next time.

Messenger Register set twice, only receives message in one place, MVVM-Light

I've got a weird problem using MVVM-Light in a WP8.1 universal app. When the download folder has been changed, I am sending out a message via Messenger that contains the new StorageFolder download folder.
I am registered to receive this message in two different viewmodel constructors (one for the main page, one for a custom file manager page). Instances of both have already been created.
When I run this in my emulator, everything works as it should. I get the message on both viewmodels. However, when I run this on my phone (Lumia 920 with developer preview), I only get the message on the main page, not the file manager page that even sends the message (from the page's own codebehind).
At a glance I'm wondering if there's a thread problem here due to the difference in speeds... but I also wonder if there's a bug on the ARM side of the MVVM-light toolkit.
Based on how I was using the MessengerInstance.Register method, I was the victim of a limitation of the Messenger system (not a bug exactly). Someone else described it here exactly:
https://mvvmlight.codeplex.com/workitem/7640
Basically, I was using a lambda that included a parameter from outside the lambda statement, making it a class held with a weak reference. This was garbage collected and then gone forever. Fixed by rewriting the entire thing...

WebProfiler is not loaded on custom environment

I'm running into a very weird issue. I have created 4 environments:
frontend_dev
frontend_prod
backend_dev
backend_prod
In frontend_dev, the profiler is shown at the bottom of the page as it should be. However, on the backend_dev environment it is not shown. Upon investigation I have found out that the piece of code to load the profiler is actually there at the body end tag, however the call to get the profiler content doesn't return anything at all.
Further investigation showed that the loadProfile method failed because $this->storage->read($token) returns NULL.
I wonder what is happening, seems like somehow the storage couldn't save the profile and thus could not read it upon request?
Edit 1:
I think I know why: previously both my frontend and my backend were using the same environment (dev) and the profiler cached the toolbar content to the same place. However, now that we are using 2 environments the profiler caches the toolbar content to backend_dev but attempts to load from frontend_dev cache folder.
I have found the reason as described above, in the end for the sake of simplicity (and also other reasons) I have separated my original app into 2 apps using this guide
So far it has worked out very well for me.

RadEditor ExportToPDF not generating PDF in client's environment

We are using the Telerik RadEditor control, specifically for it's ability to render a PDF via the ExportToPDF() method on the control. We find that this works great in our development and test environments but fails as soon as we get to our client's environment. What I mean by fails is that typically when you execute the ExportToPDF() method, a dialog box pops up with the name of the PDF file, it's size, and whether you want to open it or save it. In our client's environment that dialog window appears, but the file size does not appear. If you save the file, it's a blank document. The machines / environments are equal in their setup (IIS 6 on Windows server 2003). The only exception is that our client's machine is in a secure environment with no access to the internet.
We are loading form letters into the control and then creating the PDF once the user clicks a button, so I don't think this is being caused by bad data / invalid characters causing the PDF not to generate.
My questions are: does anyone have experience running the ExportToPDF() command in an environment with no access to the internet? Could this be a permissions issue? I can't seem to find documentation on whether the ExportToPDF() functionality uses a temporary directory to write the PDF out to while it's rendering. It may be as simple as that, but I'm having a hard time researching this issue.
I've also put a try / catch block around the ExportToPDF() method and I know it's not throwing any errors.
We are running an older version of RadEditor - 2009.3.1208 - it runs in a large application with other Telerik tools so upgrading the entire RadControl suite is not trivial (b/c of testing, etc) and is taking some time.
Any suggestions on what to try next / has anyone encountered anything like this with this control?
Thanks for your help in advance!
Richard
I doubt that the export functionality needs an active internet connection. Most likely something in your secured environment is blocking silently the export and it does not simply happen. My recommendation is to check the permissions/processes you have on the user machine and test the same outside of the local environment to compare the results.

Decrypting the YSOD, techniques to the mayhem

How many can relate do this?
Server Error in / Application
Object reference not set to an object
Description: Object reference not set to an object.
Exception Details: System.NullReferenceException: Object reference not set to an object.
Source Error:
Line 56: posts.Add(post);
On a more serious note, what are the first things you look for when you see the
yellow screen of death? Half the time the debug trace isn't actually telling you what the problem is (understandable I guess).
I must admit, I still use Response.Write more than I should. I just get lazy going through the debugger. What techniques do you use to debug the problem?
If I'm unable to identify/resolve the issue using the error message that the page presents to me, I will typically try to use the Windows Event Viewer to help me identify what is causing the issue.
For example, SharePoint errors are sometimes far less than descriptive. So, I'll combine what I'm seeing on the Y.S.O.D. with error messages from the Event Viewer to help me narrow down the cause.
I will do my best to ask a co-worker or other associate that I think might have some experience that might help. If I'm still unable to identify the cause, I will resort to Google armed with all the information.
Here's how I try to reduce the number of YSODs. One of the first things I do when starting work on an app is to create a custom exception class.
Add properties such as the SQL
statement being run. Two display
message text fields, one for display
to users, one for display to
developers (in debug mode) Who is
the logged-in user. Get all the form
variables so you know what they were
trying to enter.
Log the errors somewhere (event log
is good, if you can access the web
server; logging to the database is
less successful when so many
exceptions are inability to access
the database).
Create code in the MasterPage or web page base class Page Error events and Application Error events to do the logging.
Create a custom error page. When in
debug mode, the custom error page
displays everything. When not in
debug mode (production), display
only selected properties of the
custom exception.
Investing the time up front to do this will save you many hours of anguish later.
I usually do my debugging on my local machine with the Cassini web server (comes with VS 2005/2008). If I see an exception on my QA or, heaven forbid, my production box it's usually because I forgot to update my connection strings so that they point to the QA/production database instead of my local machine.
In other cases, I've found the stack traces to be very helpful in determining where to provide breakpoints so I step through it in the debugger and examine the data at runtime. The only time I've written any debugging information on the page was when trying to find some performance issues that I couldn't replicate on my developer instance. In this case I wrote some hidden fields that contained timing information about various parts of the render process.
the error info provided, assuming you are in debug mode, will give you information as to what line the error actually occurred on, along with the lines of code leading up to the error. This info should give you a good start on defining where to set your break points for debugging.
I was once in your shoes many moons ago, using response.write for debugging. Once you start using the IDE and debugger as it's intended you'll find yourself pulling out less hair and getting to the solutions much faster.
Also, opening up the immediate window while debugging is gonna make your life even more happy.
Use a decent logging framework such as log4net, and be liberal in your use of DEBUG-level logging.
It's essentially a neater version of your Response.Write approach, which can be left in your production code and "switched on" when required.

Resources