Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleFirst release of Visual Basic 2008 adds bug to new WPF projects
Description
KeywordsVisual Basic 2008, WPF, bug
CategoriesVB.NET, Bug Alerts
 
Due to a configuration error when shipping the first versions of Visual Basic 2008, when you create a new WPF project the result contains a bug. The template project tries to return a System.Windows.Application object from a function that should return a WpfApplication1.Application object. The error is:

Option Strict On disallows implicit conversions from 'System.Windows.Application' to 'WpfApplication1.Application'.

The error occurs in the Return statement in this code:

 
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", _
    "CA1811:AvoidUncalledPrivateCode")>  _
Friend ReadOnly Property Application() As Application
    Get
        Return Global.System.Windows.Application.Current
    End Get
End Property
 
To fix the problem, hover over the red box to get the Error Correction Options dropdown. Accept the error correction suggestion to get this fix:

Return CType(Global.System.Windows.Application.Current, _
    WpfApplication1.Application)

This error should be fixed in the first service packs and later releases of Visual Basic 2008.

Copyright © 1997-2006 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated