30

I have an error that not let me see my designer.. but I have no error on a build and my program runs fine with no problem

I have tried to:

  • Clean and Rebuild
  • Update Visual Studio
  • Repair Visual Studio
  • Restart my pc

Nothing helped. I have no idea what more I can to do to solve it.

I have to try to see in here and not worked for me even after restarted visual studio, re-built the solution

the name <...> does not exist in the namespace clr-namespace <...>

this is my Error:

enter image description here

this is Xaml file:

<Window x:Class="PulserTester.windows.ConfigPage"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:PulserTester.windows"
        xmlns:Convertors="clr-namespace:PulserTester.Convertors"
        mc:Ignorable="d" 
             d:DesignHeight="575.068" Width="500">
    <Window.Resources>
        <Convertors:NumericTextBoxConvertor x:Key="NumericTextBoxConvertor" />
    </Window.Resources>
    <Grid Background="White">
        <StackPanel>
            <StackPanel Margin="5">
                <TextBlock HorizontalAlignment="Right">שם הפולסר</TextBlock>
                <TextBox HorizontalAlignment="Right" MinWidth="100" Text="{Binding PulserName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
            </StackPanel>

            <StackPanel Margin="5">
                <TextBlock HorizontalAlignment="Right">האם להציג הודעה במצב של כישלון</TextBlock>
                <CheckBox  HorizontalAlignment="Right" IsChecked="{Binding FailQuestion,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></CheckBox>
            </StackPanel>

            <StackPanel Margin="5">
                <TextBlock HorizontalAlignment="Right">האם לאפשר בדיקת כיול</TextBlock>
                <CheckBox  HorizontalAlignment="Right" IsChecked="{Binding CalibrationOption,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></CheckBox>
            </StackPanel>

            <StackPanel Margin="5">
                <TextBlock HorizontalAlignment="Right">סגנון הבדיקה</TextBlock>
                <ComboBox HorizontalAlignment="Right" Width="213"
                          ItemsSource="{Binding CheckStyles.Keys}"
                          SelectedItem="{Binding CheckStyleSelected,UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
                          ></ComboBox>
            </StackPanel>

            <StackPanel Margin="5">
                <TextBlock HorizontalAlignment="Right">מספר המפעל</TextBlock>
                <ComboBox HorizontalAlignment="Right" Width="213"
                          ItemsSource="{Binding FactoriesNumbers}"
                          SelectedItem="{Binding FactorySelected,UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
                          ></ComboBox>
            </StackPanel>

            <StackPanel Margin="5">
                <TextBlock HorizontalAlignment="Right">תדירות השמירה בבידקות</TextBlock>
                <TextBox HorizontalAlignment="Right" MinWidth="100" Text="{Binding SaveBatteryFreq,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, Converter={StaticResource NumericTextBoxConvertor}}"></TextBox>
            </StackPanel>

            <StackPanel Margin="5">
                <TextBlock HorizontalAlignment="Right">לאפשר גבולות סטטסיטיים</TextBlock>
                <CheckBox  HorizontalAlignment="Right" IsChecked="{Binding AllowUsingStatistic, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></CheckBox>
            </StackPanel>

            <StackPanel Margin="5">
                <TextBlock HorizontalAlignment="Right">מספר התאים לתחילת הסטטסיטיקה</TextBlock>
                <TextBox HorizontalAlignment="Right" MinWidth="100" Text="{Binding NumberOfCellToStartTheStatistics,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, Converter={ StaticResource  NumericTextBoxConvertor}}"></TextBox>

            </StackPanel>

            <StackPanel Margin="5">
                <TextBlock HorizontalAlignment="Right">מספר התאים להתחול הסטטיסטיקה מחדש</TextBlock>
                <TextBox HorizontalAlignment="Right" MinWidth="100" Text="{Binding NumberOfCellToRestartTheStatistics,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, Converter={ StaticResource  NumericTextBoxConvertor}}"></TextBox>
            </StackPanel>

            <StackPanel Margin="5">
                <Button Command="{Binding Path=SaveCommand}">bb</Button>
            </StackPanel>

           
        </StackPanel>
    </Grid>
</Window>

this is my convertor:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;

namespace PulserTester.Convertors
{
    public class NumericTextBoxConvertor : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return value.ToString();
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string val = value.ToString();

            long ret = long.TryParse(new string(val.Where(char.IsDigit).ToArray()), out long result) ? result : 0;
            if (ret > int.MaxValue)
            {
                ret = int.MaxValue;
            }
            return ret;
        }
    }
}
25
  • are this converter within the same assembly as PulserTester.windows.ConfigPage window?
    – vasily.sib
    Oct 2, 2018 at 10:33
  • @vasily.sib still not work...
    – user8417115
    Oct 2, 2018 at 10:33
  • 15
    and if that doesn't work, close visual studio and delete the ".vs" directory that is inside the solution directory, then try again. You may have to show hidden files to see it. Sometimes the designer gets stuck using cached data. Oct 2, 2018 at 10:33
  • Rebuild the project and it should be able to identify the converter. Also close all files while doing rebuild.
    – Sham
    Oct 2, 2018 at 10:33
  • @vasily.sib they on the same Project if that is your question..
    – user8417115
    Oct 2, 2018 at 10:36

15 Answers 15

60

I just want to reiterate a solution that Bradley Uffner mentioned buried in the comments above.

  1. Close Visual Studio

  2. Delete the hidden .vs folder

  3. Open Visual Studio and rebuild your project

Keep in mind that this is a very generic error that has multiple causes and solutions, so this may not work for you, but it's definitely worth a shot since I know it has worked for me in the past on several occasions.

6
  • 4
    For me too, solved XDG0008. Should be marked as the answer.
    – LaoR
    May 11, 2020 at 10:38
  • Thanks for all the up-votes, but again the credit is @Bradley Uffner's. ;)
    – Fütemire
    Jul 29, 2020 at 16:05
  • 2
    Update from August 2020 - this is the only solution that solved for me this issue with VS2019 designer errors. Should be marked as accepted answer.
    – Sevenate
    Aug 5, 2020 at 0:17
  • 1
    Worked fine, many thanks @Bradley. This worked also on VS 16.8.0 preview 4 Oct 18, 2020 at 8:21
  • 1
    I had the same problem, I just had to do a rebuild. May 19, 2022 at 18:28
6

I met the same issue. I tried to build and rebuild my solution, but it didn't work. Finally, I've closed Visual Studio and re-opened it, and it's fixed!

5

I met the similar issue while viewing the workflow xaml in designer view mode. It can be resolved by below steps:

  1. Close All Visual Studio
  2. Delete the hidden .VS folder
  3. Open Visual Studio again
  4. Rebuild your project
4

You can switch to another framework version then switch back to your version, in my case I'm using VS 16.4. I changed from framework 4.6.2 to 4.7.2 then switch back to 4.6.2.

This simple action solve XDG0008 and XDG0012 in my project.

1
  • 2
    My environment was 4.6.1. I switched to 4.7.2 and it compiled OK. Thanks for your comment here, this one worked.
    – JasonH
    Feb 4, 2020 at 19:57
2

Solved the same problem. Steps:

  • Update Visual Studio.
  • Close/open it.
  • Rebuild.
1

I was able to get rid if this problem in the past by adding the actual assembly name to the namespace reference like this:

xmlns:windowManager="clr-namespace:PulserTester.Convertors;assembly=TheNameOfTheAssemblyWithoutExtension"

This has worked for me in the past.

1

I solved this by deleting the folder .vs/$(SolutionName)/DesignTimeBuild, so I can keep VS configuration/explorer/tabs, which are lost when deleting the whole .vs.

0

I got the same issue. I found, that the project with the control was not included in the solution (.sln file). Simple adding the project to the solution fixes the issue.

0

Do not use a UNC path for your project folder but map a drive letter instead.

0

Do not use clr-namespace syntax, use "using", for example:

change "clr-namespace:your.namespace" to "using:your.namespace"

0

My Xaml issue in the same location (no converters to be clear) was a different XDG0000 and it stemmed from a cut and paste of code from OneNote into the xaml.

For some reason the pasted text ended up with hidden characters(NBWS to be exact) wherever there were line breaks. By removing all linebreaks between controls and bringing the control attributes onto one line such as from:

<TransformGroup>
    <ScaleTransform CenterX="0.5" 
                    CenterY="0.5" 
                    ScaleX="1.5" 
                    ScaleY="1.5"/>

</TransformGroup>

to

<TransformGroup>
    <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1.5" ScaleY="1.5"/>
</TransformGroup>

Resolved the issues.

I present this here as an alternative to generic issues found in the .Resources section of a xaml page.

0

I've been having this problem, my problem was my UserControl file has an Event in it which was causing the Error X0008.

Deleting that Click event from my UserControl and compiling without it cleared the error. Presumably its the same for all events, as they can not be called in UserControl Xaml files.

<UserControl x:Class="UIControls.MTRY_Button"

       ...

<Grid>
    <Button Content = "Click Me" Height = "23" 
     HorizontalAlignment = "Left" Margin = "96,88,0,0" Name = "button" 
     VerticalAlignment = "Top" Width = "75" **Click = "button_Click"** />
</Grid>

Here's the youtube video that I found the solution in revealed at about 3:40 https://www.youtube.com/watch?v=lU4RuEXlUiU Create your own Usercontrol in WPF or UWP By: CodeDocu Developer C# Asp Net Angular

0

Ok, those above are great excamples.

It turned out that i had another issue, i had databound integer, that was change from nullable one, to regular (int? was changed to int), this was due to the fact that a nullable integer would cause pain later on, but I forgot that on constructor for that class i had assigned null to that int? and didn't reverse it when it was changed. I found it only by commenting out all bound converters, and controls. So before trying above, try to think what you had changed lately :).

0

For me just closing the visual studio and then reopening it solved the issue, I did not even have to delete the .vs file.

0

Also, try just closing your app window before building (I might or might not have been looking for solutions for a full hour before realising it was open)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.