none
XamlParseException after upgrading from .NET 3.5 to .NET 4 RRS feed

  • Question

  • I've just converted my VS2008/.NET 3.5 project to VS2010/.NET4 Client Profile and now my app is throwing this exception which is wasn't before. I haven't been able to find any info on this, so hopefully someone on this forum can shed some light. It's complaining about setting a textbox IsReadOnly property which I only reference in one place in my project (and also happens to be in the user control that I believe is being removed from the control tree when this occurs):

          <TextBox
            x:Name="discName"
            Focusable="False"
            Grid.Row="2"
            Grid.Column="1"
            Margin="0,0,5,5"
            IsReadOnly="True"
            TabIndex="3"
            >
            <TextBox.Text>
              <Binding
                Path="DiscName"
                UpdateSourceTrigger="PropertyChanged"
                ValidatesOnDataErrors="True"
                />
            </TextBox.Text>
          </TextBox>

    Here is the exception dump:

    Unhandled exception: System.Windows.Markup.XamlParseException: Cannot set unknown member 'System.Windows.Controls.TextBox.IsReadOnly'. ---> System.Xaml.XamlObjectWriterException: Cannot set unknown member 'System.Windows.Controls.TextBox.IsReadOnly'.
       at System.Xaml.XamlObjectWriter.WriteStartMember(XamlMember property)
       at System.Xaml.XamlWriter.WriteNode(XamlReader reader)
       at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter)
       --- End of inner exception stack trace ---
       at System.Windows.Markup.XamlReader.RewrapException(Exception e, Uri baseUri)
       at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter)
       at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlObjectWriter objectWriter)
       at System.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(DependencyObject container, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
       at System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren)
       at System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)
       at System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container)
       at System.Windows.FrameworkElement.ApplyTemplate()
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.DockPanel.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
       at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Border.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Control.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.DockPanel.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
       at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Border.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Control.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.ContextLayoutManager.UpdateLayout()
       at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
       at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
       at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
       at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
       at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

     

    • Edited by BrilliantSoftware Thursday, November 25, 2010 5:32 PM Repasting xaml for formatting
    Thursday, November 25, 2010 5:27 PM

All replies

  • Hi BrilliantSoftware,

    Can you reproduce this error in another project? It will be very helpful for our investigation if we can reproduce it.

    Would you please share more about your application to let us have a better understanding of this problem? When does this error occur?

    You can also try removing the reference to PresentationFramework assembly and re-add a reference for the 4.0 version of that assembly in your project.

    Best regards,

    Min


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Monday, November 29, 2010 7:04 AM
    Moderator
  • I have this problem too. Someone have solution?
    Wednesday, January 19, 2011 12:34 PM
  • Hi BrilliantSoftware,

    I too have the same issue while upgrading from .Net 3.5 to .Net 4. Did u get the solution?

    Regards,

    Santhosh

    Thursday, April 28, 2011 1:32 AM
  • Hi all,

    Thanks for the feedbacks.

    It's hard for us to investigate this issue because we cannot reproduce this issue on our side so far. I did some search and also see a connect post about this issue. http://connect.microsoft.com/VisualStudio/feedback/details/505437/net-framework-4-beta-2-controltemplate-unknown-isreadonly-in-textbox-in-combobox 

    It will be very helpful if someone can provide a sample project to reproduce this problem.

    Best regards,


    Min Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, April 28, 2011 1:59 AM
    Moderator
  • If we align the stars right, we can get a repro in our company.  Please let me know if interested in taking a look.

    Thank you,  eugen_nw


    Thank you, eugen_nw
    Tuesday, August 16, 2011 8:59 PM
  • Hello,

    can you please post the begging of the xaml where you make the including. Also see this link i think it will be useful http://stackoverflow.com/questions/6850713/weird-xaml-parsing-error-when-trying-to-set-textbox-isreadonly since we dont have code of your application Thank you.


    Tuesday, August 16, 2011 10:21 PM
  • @DimitarGeorgiev: I thought it will be Microsoft who will be interested in looking into this issue, since they own the PresentationFramework.dll.
    Thank you, eugen_nw
    Tuesday, August 16, 2011 10:44 PM
  • Hello,

    i think that both microsoft and the community will be interested about the issue. It will be very helpful to give more information about the issue

    Tuesday, August 16, 2011 10:50 PM
  • I attempted to reproduce this error in .NET 3.5, .NET 4.0, and .NET 4.0 Client Profile without any negative results. Is this the entirety of your code? I'm going to hazard a guess that there's something else tripping up the parser somewhere.


    Ask for something to be done once, it will be done once. Ask how to do something, and you will be able to do it as many times as you need.
    Wednesday, August 17, 2011 1:08 AM
  • Hi eugen_newsgroups,

    Thank you! Could you please open a post at the connect site http://connect.microsoft.com/VisualStudio and upload your repro for further investigation?

    Thanks again for your support!

    Best regards,


    Min Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, August 17, 2011 1:50 AM
    Moderator
  • While the XAML itself is simple - please see below - the repro is not. 

    <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" VerticalAlignment="stretch" HorizontalAlignment="stretch" Background="LightGreen" >
      <Grid VerticalAlignment="Center" HorizontalAlignment="Center" >
        <TextBox Text="Word" Margin="2" IsReadOnly="True" />
      </Grid>
    </UserControl>

    We're seeing this behavior in a CAB - http://msdn.microsoft.com/en-us/library/bb266334.aspx - application.  We start off having this view in a freshly installed Module A and it works great.  Once we install a couple more modules and launch the application in Module A, the view throws the System.Windows.Markup.XamlParseException exception.  I'll see about uploading the repros to http://connect.microsoft.com/VisualStudio

    Thanks much,  eugen_nw
     


    Thank you, eugen_nw
    Wednesday, August 17, 2011 4:09 PM