Skip to content

Can't create Custom Control without this error #9509

@Nanolocity

Description

@Nanolocity

Description

image
There's nothing to say honestly, I just tried creating a Custom Control and this keeps happening.

What I tried:
-restarted VS
-repaired VS
-tried different filenames

Reproduction Steps

Click Add > New Item > C# Items > Custom Control (WPF)

Expected behavior

Create a Custom Control file

Actual behavior

After building, it'll tell you that you can't have two partial classes with different base components or something close to that effect, that's because then on build it generates a Generic.g.cs and a Generic.g.cs.i which then contain basic info about the class, like initialization, etc, BUT this also results in said error and as soon as I try to remove/replace, overwrite the file AND BUILD it does it again of course

The two Generic files are the identical, so here's their contents:
`#pragma checksum "........\Themes\Generic.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "63F4B9E80A4B5A3A68BFB8979E63A290EB92DAED"
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------

using Listen.UserControls;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Controls.Ribbon;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Effects;
using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using System.Windows.Media.TextFormatting;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Shell;

namespace Listen.UserControls {

/// <summary>
/// PopupButton
/// </summary>
public partial class PopupButton : System.Windows.ResourceDictionary, System.Windows.Markup.IComponentConnector, System.Windows.Markup.IStyleConnector {
    
    private bool _contentLoaded;
    
    /// <summary>
    /// InitializeComponent
    /// </summary>
    [System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "8.0.7.0")]
    public void InitializeComponent() {
        if (_contentLoaded) {
            return;
        }
        _contentLoaded = true;
        System.Uri resourceLocater = new System.Uri("/Listen;component/themes/generic.xaml", System.UriKind.Relative);
        
        #line 1 "..\..\..\..\Themes\Generic.xaml"
        System.Windows.Application.LoadComponent(this, resourceLocater);
        
        #line default
        #line hidden
    }
    
    [System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "8.0.7.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
    void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
        this._contentLoaded = true;
    }
    
    [System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "8.0.7.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
    void System.Windows.Markup.IStyleConnector.Connect(int connectionId, object target) {
        switch (connectionId)
        {
        case 1:
        
        #line 99 "..\..\..\..\Themes\Generic.xaml"
        ((System.Windows.Shapes.Path)(target)).MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.changeOpen);
        
        #line default
        #line hidden
        break;
        }
    }
}

}

`

Regression?

No response

Known Workarounds

No response

Impact

I literally can't make any further Custom Controls, please help me qwq

Configuration

.NET 7
Windows 11 Pro - Version 10.0.22631 Build 22631
x64
No idea

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions