29

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;
        }
    }
}
Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
  • are this converter within the same assembly as `PulserTester.windows.ConfigPage` window? – vasily.sib Oct 02 '18 at 10:33
  • @vasily.sib still not work... –  Oct 02 '18 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. – Bradley Uffner Oct 02 '18 at 10:33
  • Rebuild the project and it should be able to identify the converter. Also close all files while doing rebuild. – Sham Oct 02 '18 at 10:33
  • @vasily.sib they on the same Project if that is your question.. –  Oct 02 '18 at 10:36
  • @BradleyUffner Not work :( –  Oct 02 '18 at 10:37
  • Try deleting the Convertors:NumericTextBoxConvertor and then adding it back in. This has already worked for me. – Neil B Oct 02 '18 at 10:38
  • @NeilB Nothing... T_T –  Oct 02 '18 at 10:40
  • are you add this lines (converter's) by hand or by means of visual studio? – vasily.sib Oct 02 '18 at 10:49
  • @vasily.sib witch lines? this "xmlns:Convertors="clr-namespace:PulserTester.Convertors"" ? I added it by heands –  Oct 02 '18 at 10:54
  • ok, are there any other errors, that prevent project from build? If you delete all lines about this converter, will project build succesfully? – vasily.sib Oct 02 '18 at 11:16
  • @vasily.sib Nop "========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========" –  Oct 02 '18 at 11:20
  • now try step-by-step: add `xmlns:conv="clr-namespace:PulserTester.Convertors"` - Build - add `` to `` - Build - add `NumericTextBoxConvertor` to binding - Build – vasily.sib Oct 02 '18 at 11:32
  • @vasily.sib Still the same error on Resources line... :( –  Oct 02 '18 at 11:41
  • oh:( another guess - when you type in XAML ` – vasily.sib Oct 02 '18 at 11:55
  • @vasily.sib It is just show option to chose this text : NumericTextBoxConvertor –  Oct 02 '18 at 12:11
  • @jon are you able to run, though some times it might show, but if build is succeed then you can run the application and check it. – G K Oct 02 '18 at 12:34
  • @GK I run it for some hours and it run fine... but still the errors... –  Oct 02 '18 at 12:39
  • You mean that you are able to run the application but it shows error in ErrorList window? Are you able to see the designer or does it shows as Error? – G K Oct 03 '18 at 14:59
  • @GK I mean that I am able to run my application fine. But I have an error on my designer I am not able to see that... its show an error –  Oct 04 '18 at 06:38
  • I have faced this issue many times before and even now in some places of current project, I haven't looked yet on how to fix such issues, but will definitely look into it. You can edit your question and say designer issues and post that designer stack trace. – G K Oct 06 '18 at 06:30
  • I have tried with your xaml and converter in VS 2017. Initially it showed me not found issue, but once I rebuild my solution, the error went off and I can see designer as well. – G K Oct 07 '18 at 06:23
  • @GK Its part of a solution of Winform project. maybe it can be a problem? –  Oct 07 '18 at 06:55
  • Since this is a visual studio issue (for you said it builds w/no errors) what version of Visual studio are you using (add it to the tags)? Have you updated Visual Studio to the latest? Have you tried this in Blend? – ΩmegaMan Nov 05 '18 at 20:04
  • Please Tweet these errors to Microsoft, if they get enough maybe they'll do something about it. They are currently under the illusion that WPF works perfectly all the time. The reality is that it's about as stable as a Lego bridge. – Paul McCarthy Apr 19 '19 at 11:26

15 Answers15

59

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.

Pang
  • 9,564
  • 146
  • 81
  • 122
Fütemire
  • 1,705
  • 1
  • 26
  • 21
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!

Pang
  • 9,564
  • 146
  • 81
  • 122
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
Peter Csala
  • 17,736
  • 16
  • 35
  • 75
Will Young
  • 51
  • 1
  • 3
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.

Juan Pablo Gomez
  • 5,203
  • 11
  • 55
  • 101
  • 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 04 '20 at 19:57
2

Solved the same problem. Steps:

  • Update Visual Studio.
  • Close/open it.
  • Rebuild.
Pang
  • 9,564
  • 146
  • 81
  • 122
Collega
  • 424
  • 6
  • 12
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.

Jonathan Alfaro
  • 4,013
  • 3
  • 29
  • 32
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.

Soleil
  • 6,404
  • 5
  • 41
  • 61
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.

Lipotam
  • 236
  • 2
  • 13
0

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

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

ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122
0

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

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.

ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122
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

willie
  • 13
  • 1
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.

Rubayat26
  • 5
  • 1
  • 6
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)