Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6381871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:27:01+00:00 2026-05-25T02:27:01+00:00

I finally found the problem, but there is no way this is making sense,

  • 0

I finally found the problem, but there is no way this is making sense, it just doesn’t seem possible. Is this even fixable? I thought namespaces all worked the same, you could call and access controls from different namespaces by typing thenamespace.theclass ect, this was mainly used for categorizing (for me anyways).

My problem is serializing doesn’t seem to accept new namespaces, the ResX code it generates is bugged unless the references are in the same namespace as the project namespace.

Original Error:

Error 1 Invalid Resx file. Could not load type Namespace2.FileFiltering, WindowsFormsApplication1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null which is used in the .RESX file. Ensure that the necessary references have been added to your project. Line 127, position 5. c:\users\aderic\documents\visual studio 2010\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Form1.resx 127 5 WindowsFormsApplication1

I would like a reusable control but I don’t want to make a DLL out of it. (I can obfuscate it but I’d rather not have people importing it and using it). I have 2 classes, they would compile normally but because I chose a different namespace, the only compile error deals with the ResX not finding the object. Here are the 2 classes:

using System;
using System.Windows.Forms;
using System.Runtime.Serialization;

namespace Namespace2
{
    class TestObject : Control
    {
        System.Collections.Generic.List<Namespace2.FileFiltering> InternalExtensions = new System.Collections.Generic.List<Namespace2.FileFiltering>();

        [System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)]
        public System.Collections.Generic.List<Namespace2.FileFiltering> ExtensionList
        {
            get
            {
                return InternalExtensions;
            }
            set
            {
                InternalExtensions = value;
            }
        }

        public TestObject()
        {
            BackColor = System.Drawing.Color.Gray;       
        }
    }

    [Serializable]
    public class FileFiltering : ISerializable
    {
        String InternalFileType = "New File Type";
        String[] InternalExtensions = new String[] { "*.*" };

        public String FileType
        {
            get
            {
                return InternalFileType;
            }
            set
            {
                InternalFileType = value;
            }
        }
        public String[] Extensions
        {
            get
            {
                return InternalExtensions;
            }
            set
            {
                InternalExtensions = value;
            }
        }

        public FileFiltering()
        {

        }

        public FileFiltering(SerializationInfo info, StreamingContext context)
        {
            FileType = info.GetString("FileType");
            Extensions = (String[])info.GetValue("FileExtensions", typeof(String[]));


            //Debugging.
            Console.WriteLine("FileType is " + FileType);
            Console.WriteLine("First extension is " + Extensions[0]);
        }


        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            info.AddValue("FileType", FileType);
            info.AddValue("FileExtensions", Extensions);
        }
    }
}

Does anyone know a workaround for this or am I just stuck? I’ve worked hours on this, finally after awhile got it to serialize, the properties working and everything, at least a few of those errors were me just learning that it doesn’t play nice with a namespace different from the project namespace.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:27:01+00:00Added an answer on May 25, 2026 at 2:27 am

    The problem has nothing to do with namespaces per-se. Simply that the framework can’t locate the class when it’s trying to deserialize the Control.

    This can be overcome by specifying a custom serializer to use when the framework tries to deserialize that property – which can be accomplished with the DesignerSerializerAttribute.

    The documentation for Designer Serialization:
    http://msdn.microsoft.com/en-us/library/ms171834.aspx

    Honestly, I’d avoid designer serialization altogether unless you have a specific need for it (especially since you mention you’re not interested in having other developers reuse your control).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There must a million variations of this problem but I don't seem to be
I finally found out the difference between UTC and GMT by making the effort
I've finally found a way to debug classic asp code in visual studio 2008
I have looked into this fairly extensively, but have not found quite what I
I've finally found a client for my hosted software - the first time I've
I have searched a lot about regex and finally I found out that it's
I found out recently that JList (finally!) was generified in JDK7. Why JTree and
Finally deployed my ruby on rails 3.2 app but when trying to open it
Finally figured it out thanks to One Mad Monkey, but forgot quotes on my
I've spent a great long while googling this problem without any luck and I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.