Fix for the DataGrid does not exist in the namespace error in Silverlight 2 beta 2

by APIJunkie 6/10/2008 7:27:00 AM

When upgrading an existing Silverlight project to silverlight 2 beta 2 you might encounter the following error:

"The type or namespace name 'DataGrid' does not exist in the namespace 'System.Windows.Controls' (are you missing an assembly reference?)"

To solve the problem:

1. First go to your project references (Expand your project references sub tree in the Visual Studio IDE) and  look for System.Windows.Controls.Data in the reference list.

(If it does not exist in the list then you probably had the problem before the upgrade and you need to add a reference to System.Windows.Controls.Data by going to Project/Add Reference/.Net and choosing it from the list)

2. Press the right button on the System.Windows.Controls.Data reference and choose properties.

3. If the "Specific Version" property is set to true, change the "Specific Version" property to False.

4. Rebuild the project/solution.

This solved the problem for us on several Silverlight projects using a DataGrid.

Cheers

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Silverlight | PRB | Troubleshoot | How To

Getting around Silverlight 2 beta 1 error 4002 while changing visibility of a control on mouse click event

by APIJunkie 5/27/2008 11:27:00 PM

While working on  Bumble Beegger we came across a daunting problem that only seemed to happen under certain conditions.

Silverlight error message
ErrorCode: 4002
ErrorType: ManagedRuntimeError
Message: System.Exception: Error HRESULT E_FAIL has been returned from a call to a COM component.
at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
at System.Windows.DependencyObject.MethodEx(String methodName, CValue[] cvData)
at System.Windows.UIElement.ReleaseMouseCapture()
at System.Windows.Controls.Primitives.ButtonBase.ReleaseMouseCaptureInternal()
at System.Windows.Controls.Primitives.ButtonBase.OnLostFocus(RoutedEventArgs e)
at System.Windows.Controls.Primitives.ButtonBase.OnLostFocus(Object sender, RoutedEventArgs e)
at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName) 

After a few hours of debugging, experimenting and googling I came across a discussion on Silverlight.net that shed some light on the problem.

As it turns out there is bug in Silverlight 2 beta 1 that can cause a crash when changing the visibility of a button control inside a mouse event handler.

The recommended workarounds around this problem were to change the size to 0,0 or change the opacity to 1.

Another option is to use the Canvas.ZIndexProperty and set it to a number that is smaller then your foreground elements.

The problem is that those does not always produce a similar enough effect in other elements.

If you still want to use visibility where possible, you can check the type of control and choose to modify visibility, size, opacity or Z Index according to the type.

Granted this is a horrible hack but it gets the job done until we can get our hands on beta 2...

Example:

// assume uiElement points to some valid UIElement

UIElement uiElement;

// check element type, if its not a button set visibility to collapsed else use ZIndex for a similar effect

if (uiElement.GetType() != typeof(Button)) 

   uiElement.Visibility = Visibility.Collapsed;

else

   ((Button)uiElement).SetValue(Canvas.ZIndexProperty, -1);

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Silverlight | PRB | How To | Debug

Cannot access localhost on Vista when debugging local ASP.NET Applications

by APIJunkie 5/6/2008 5:31:00 PM

If you are trying to debug ASP.NET applications on Vista you might run into the following problem:

localhost is not accessible through your browser and the error that is displayed is "Internet Explorer cannot display the webpage".

After some googling I ran across a reference to the same problem.

The problem has to do with the fact that there are 2 entries for local host in the hosts file ([Windows directory]\System32\drivers\etc\hosts).

One for ipv4 and one for ipv6.

Example:

127.0.0.1 localhost
::1 localhost

To solve the problem you can remark one of them. The example below remarks the ipv6 entry.

127.0.0.1 localhost
# Causes problems when using localhost ->
#::1 localhost

Note that you might not be able to modify the hosts file even if you are running as an administrator.

The following Microsoft KB explains how to change the hosts file:

http://support.microsoft.com/default.aspx?scid=kb;en-us;923947

Hope this helps...
 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

ASP.NET | PRB | Vista | How To | Debug

The type name X does not exist in the type Y error in a Silverlight project

by APIJunkie 4/27/2008 8:25:00 AM

If you run into this message when building a Silverlight project and have a class name and a namespace name that are identical you might be suffering from some kind of naming problem in the Silverlight development environment.

I found another reference to the problem in an MSDN forum.

To solve the problem I renamed the class name to a different name (one that is not identical to the namespace name).

Hope this helps...

 

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Silverlight | PRB | Troubleshoot

Fixing the missing symbols problem when debugging 32-bit applications on Windows 64-bit using WinDbg

by APIJunkie 3/22/2008 7:34:00 AM

Last week we were trying to debug legacy 32-bit applications that were misbehaving on Windows 2008 64-bit.

Microsoft's debugging tools for windows information page states the following regarding When to Use 64-bit Debugging Tools.

"The 64-bit versions of Debugging Tools for Windows allow you to debug both 32-bit and 64-bit user-mode applications running on 64-bit processors. Use this package to debug both the application and the WOW64 emulator."

Unfortunately WinDbg 64-bit does not seem work properly on at least some of the 32-bit apps running on windows 2008 64-bit that we have tested.

The problem is that WindDbg does not seem to find the correct symbols for the 32 bit application you try to debug even though WinDbg finds the correct PDB symbol files.

To solve the problem we had to install the 32-bit version of the debugging tools for windows side by side with the 64-bit version (we did not have to uninstall the 64-bit version) and use the 32-bit version to debug the 32-bit applications running on the 64 bit version of windows. 

Note that the version of the debugging tools for windows we used for both 32 and 64 bit debugging was version 6.8.4.0 released on October 18, 2007.
 

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Win32 | PRB | Win64 | Debug

How to fix the server method failed Maximum length exceeded error when using ASP.NET AJAX

by APIJunkie 3/14/2008 1:21:00 AM

If you are using ASP.NET AJAX to create RIA's (Rich Internet Applications) you might run into the maximum length exceeded error.

This error occurs when you are trying to send too much data using ASP.NET AJAX from the client to the server and vice versa.

On the function call stack level this error occurs at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize or at System.Web.Script.Services.RestHandler.InvokeMethod depending if you are sending or receiving data.

The problem is that the default maximum size (102400 characters) does not suffice when you try to transfer a significant amount of data.

To increase the maximum allowed send/receive data you need to change the MaxJsonLength Property.

To change the MaxJsonLength Property you can edit your web.config file.

Look for the following commented section in the web.config file:

 

<!--
Uncomment this line to customize maxJsonLength and add a custom converter -->

<!--

<jsonSerialization maxJsonLength="500">

<converters>

<add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>

</converters>

</jsonSerialization>

-->

 

Convert it to something along the following lines (see note below):

 

<!--
Uncomment this line to customize maxJsonLength and add a custom converter -->

<jsonSerialization maxJsonLength="200000"><

converters>

<!--<add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>--></

converters>

</jsonSerialization>

 

Note that in the example above the max size was set to 200,000 characters.

You should calculate and test the size you will need for your data (there might be a few bytes of overhead so take that into account).

 

Currently rated 3.5 by 13 people

  • Currently 3.461539/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

.NET | AJAX | PRB | JSON | How To

Fix for Remote Desktop Blank Screen Bug when using the Dell Wireless WLAN Card Utility

by APIJunkie 2/5/2008 9:51:00 AM

I've recently encountered an annoying bug when trying to connect to a dell laptop using Remote Desktop..

Every time a remote desktop connection will be established to the laptop machine and the laptop was using a wireless connection, the following would happen:

1. The remote desktop logon screen would appear on the connecting side.

2. Entering the logon info would lead to a power down of the wireless card on the remote laptop machine.

3. The connection will be broken on the laptop side.

3. A blank remote desktop screen would appear on the connecting machine.

4. The remote desktop connection will eventually time out on the connecting machine.

The problem seems to be related to power saving options but cannot be resolved using the advanced parameters available with the wireless card.

The problem only appears when using the Dell Wireless WLAN Card Utility.

This problem was produced on a dell laptop running Windows XP SP2 with a dell wireless 1390 card.

To solve the problem disable the Dell Wireless WLAN Card Utility and let Windows manage the wireless configuration.

To do that:

1. Open Dell Wireless WLAN Card Utility in the Control Panel.

2. Uncheck the "Let this tool manage your wireless networks" check box.

3. Configure your wireless connection using the standard Windows wireless utility.

If any one else had a similar problem on their dell laptops please drop me a comment below so I can collect more data to send to Dell regarding this bug.

Sponsored link:
Terminal Services and Remote Desktop Software

Currently rated 4.8 by 6 people

  • Currently 4.833333/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

PRB | Dell | wireless | Remote Desktop

Internet Explorer ATL ActiveX event not firing (IConnectionPointContainerImpl Advise not called on time)

by APIJunkie 1/25/2008 10:54:00 AM
This is a heads up for people developing ActiveX  controls for IE. The problem was demonstrated on IE 7 but might be true on other browser versions.

If you embed an ATL based ActiveX control inside a web page and try to send/fire events to the script and find out that the events are not generated then you might have the following problem.

As a simple debug trace can demonstrate initiation of ActiveX controls and script on a web page is done synchronically by one thread.

At first, objects are created, then any global script code gets executed and only after that IConnectionPointContainerImpl Advise gets called to establish a connection between the connection point and a sink.

Now the problem is that if you call a member function of the ActiveX object in the global script and this function tries to generate events those events will never be generated since the advise function was not called yet.

A simple solution to the problem, although a little bit of a hack, is to make sure you never call ActiveX functions when the page initializes.

Instead you can use a timer event handler function and call the ActiveX functions from inside the timer event handler this will insure that advise gets called to register the event handlers before you call any ActiveX member functions.

Example:

Lets assume we have a init function in the JavaScript script that does some ActiveX initialization.

function InitActiveX()

{

MyActiveXObj.Myfunction(parameters);

}

//InitActiveX(); //-> PRB: un remarking this line will cause the advise function not to get called on time!!

var timerId = setTimeout('InitActiveX',1000); // this works because the advise function will get called before the timer event handler function gets executed!!

Note that even a time delay of 0 works because it still makes sure the function is not called directly from the global script.

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

C++ | PRB | ActiveX | ATL

How to help a sleep deprived Vista based computer when the Wake Source Device is a USB Root Hub

by APIJunkie 1/22/2008 7:48:00 AM

Recently One of my Vista machines started suffering from insomnia.
 
Every time Vista would go into sleep mode it will power down but will immediately wake up after a couple of seconds.
 
A little search in the windows system event log produced the following event: EventID 1, Wake Source: Device -USB Root Hub.
 
A little further search on Google landed me in a Microsoft KB that might help some one else but did not solve my problem:
 
A computer that is running Windows Vista appears to sleep and then immediately wake.
 
Although the above KB did not solve my problem, it came pretty close.
 
As it turns out some devices do not behave very well with power management turned on.
 
In my case it was a USB mouse.
 
To solve my problem I had to disable the mouse ability to wake up the computer from sleep mode.
 
In your case it might be another connected device.

If you want to disable a device's ability to wake your computer from sleep mode follow the steps below:
 
 1. Click Start, right-click Computer, and then click Manage.
 
 2. In the User Account Control dialog box, click Continue.
 
 3. Click Device Manager, expand the device family in question (in my case it was "Mice and Other Pointing Devices").
 
 4. Right-click the device, and then click Properties.
 
 4. Click the Power Management tab, uncheck the "Allow this device to wake the computer" check box, and then click OK. 
 
Hope this helps some one else...
 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

KB | PRB | Troubleshoot | Vista | Sleep Mode

Powered by BlogEngine.NET 1.2.0.0
Theme by Mads Kristensen

About the author

Name of author

My name is Bacon…James Bacon.

I am an API wars veteran I was wounded by x86 assembly, recovered and moved on to C. I am currently stuck in C++ and sniffing .NET.

I am mainly here to ramble about coding, various API’s, Junkies(me especially) and everything else that happens between coders and their significant other.

E-mail me Send mail


Calendar

<<  September 2008  >>
MoTuWeThFrSaSu
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

View posts in large calendar

Pages

    Recent comments

    Authors

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2008

    Sign in