WPF Web Application throws System.MissingMethodException while calling Javascript method in IE9/IE10/IE11

Problem description

  • You have a WPF web application as XBAP package. 
  • You want your application communicate with Javascript via BrowserInteropHelper.HostScript. 
  • Your clients decided to upgrade to Windows 8.
  • Your application works in IE8 but throws System.MissingMethodException in IE9/IE10/IE11.
  • You did everything but no luck.

Solution

Although the problem seems frustration.  The solution is simple. You need to call your function as a function of document object. So, you need to change two parts/lines of your existing code as shown red below.

//WPF/.Net part
dynamic host = BrowserInteropHelper.HostScript;
host.document.OnYourWPFApplicationLoaded(new CallbackObject(this));
//Javascript part
document.OnYourWPFApplicationtLoaded = function OnYourWPFApplicationtLoaded(callbackObj) {        
   ...
}

And … That’s it 🙂

Advertisements
Quote

The distance is…

The distance is nothing: it is only the first step that costs.
Madame Deffand

Sometimes our dreams are located far from our action zone. But any long distance is achieved with an initial step… If you want to achieve your goals, the only option may be to get out of your comfort zone to execute the strategy of “go and get it” !

Link

Personality first

I believe that soft skills must be considered as the indispensable skill sets during a hiring process. Hard skills are kind of play doh, that is, it is learnable, transferable, changeable, switchable and so on… Soft skill owners should be considered as “water“, that is, they will take the form of its container, easily.  No big deal. Soft skill owners should be considered as “pick-lock“, that is, they will eventually open any door even if they don’t have the unique special key for that lock at the moment of hiring process. No fear, no worry. Acquiring driving certificate is not a big deal but becoming a chauffeur who is resilient to weather conditions, day&night vision, shifting sands, slippery hills and so on… absolutely takes years.  What is more, these kind of soft skills are applicable and indispensable independently of the model of the car you drive… Of course, hard skills are also essential requirement to be addressed.  However, each job position requires a specific hard skills to possess.  It is not trivial, if not impossible, to find best fits who fit all.  In addition, missing hard skills can be acquired and even certificated within months, but owning soft skills takes years of experience.  Being humble is far more important than to be specialist of , i.e., concurrency, since the humble candidate owns the power of asking.  On the other hand, some soft skills are considered to be even native such as entrepreneurship. It is neither mobile first nor web first. It is personality first… So, the importance of the hard skills are several times less than that of the soft skills. If hard skills are considered to be as “glass“, then the soft skills must be featured as “diamond“. The following article underlines perfectly the importance of soft skills over hard skills. Personality is more important than the resume

Hiding content from search results by using “display:none or noindex” in Sharepoint Search 2013

Below is a critical tip that is gone, I believe, unnoticed for Sharepoint Search 2013.

Sample Scenario

Let’s say you want to show a list of countries by using an accordion control.   The control is shown collapsed when it is first downloaded from the server. 

Collapsed state (default)

image

Expanded ( after explicit user interaction)

image

The problem

The text in the accordion items are not included in the search results by no means.  

I found no information about the solution of this problem by any resource on the web. So, I had to discover it by intuitive experimental diagnosis and thought it will be useful to share it on the web for those who have the same problem.

Solution

You should set display:none property by css file reference instead of inline css style setting.

The critical information is that Sharepoint 2013 Search crawler doesn’t process texts under tags where inlinedisplay:none” styling is set.  The effect is recursive to inner tags as well.  But the crawler processes the content as expected if display:none property is set by external css file reference.  You should consider using setting display:none from an external css file if you want to load the content invisible by default. 

image

Additional information

You may want to exclude the content from search results.  In this case, setting display:none property inline may be your friend.   However, if you want to show the content yet exclude it from search result you should use noindex class.

image

Note: noindex class will only effect the text of the node it was assigned to.  It is not effective recursively, so, it won’t effect the inner nodes of noindex tag.