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 8699959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:04:35+00:00 2026-06-13T02:04:35+00:00

I am getting this exception… System.ArgumentNullException: Value cannot be null. Parameter name: typeName at

  • 0

I am getting this exception…

System.ArgumentNullException: Value cannot be null.
Parameter name: typeName
   at HomeInventory2.Services.Factory.GetService(String servicename) in C:\Users\Protego\Documents\Visual Studio 2010\Projects\HomeInventory2\HomeInventory2\Services\Factory.cs:line 37
   at HomeInventory2.Business.Manager.GetService(String name) in C:\Users\Protego\Documents\Visual Studio 2010\Projects\HomeInventory2\HomeInventory2\Business\Manager.cs:line 14
   at HomeInventory2.Business.InventoryMngr.Create(CreateInventory inv) in C:\Users\Protego\Documents\Visual Studio 2010\Projects\HomeInventory2\HomeInventory2\Business\InventoryMngr.cs:line 19
   at HomeInventory2.Form1.submitButton_Click(Object sender, EventArgs e) in C:\Users\Protego\documents\visual studio 2010\Projects\HomeInventory2\HomeInventory2\Form1.cs:line 52
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Stemming from this code –

private void submitButton_Click(object sender, EventArgs e)
        {
            CreateInventory create = new CreateInventory();
            create.ItemAmount = textBoxAmount.Text;
            create.ItemCategory = textBoxCategories.Text;
            create.ItemProperties = textBoxValue.Text;
            create.ItemValue = textBoxValue.Text;

            InventoryMngr invtryMngr = new InventoryMngr();
            invtryMngr.Create(create);

        }

That code should end in a file being created with those values being saved to a text file. Obviously something is breaking down along the line – I am assuming in the InventoryMngr file which looks like this.

namespace HomeInventory2.Business
{
    public class InventoryMngr : Manager
    {
        /// <summary>
        /// persists the inventory information
        /// </summary>
        /// <param name="inv"></param>
        public void Create(CreateInventory inv)
        {
            InventorySvc inventorySvc =
            (InventorySvc)GetService(typeof(InventorySvc).Name);
            inventorySvc.CreateInventory(inv);
        }
    }
}

The business manager get service

namespace HomeInventory2.Business
{
    public abstract class Manager
    {
        private Factory factory = Factory.GetInstance();
        protected IService GetService(String name)
        {
            return factory.GetService(name);
        }
    }
}

And the Factory getservice

public IService GetService(string servicename)
{
    Type type;
    Object obj = null;
    try
    {
        type = Type.GetType(GetImplName(servicename));
        obj = Activator.CreateInstance(type);
    }
    catch (Exception e)
    {
        Console.WriteLine("Exception occured: {0}", e);
        throw e;
    }
    return (IService)obj;
}

GetImplName

private string GetImplName(string servicename)
        {
            NameValueCollection settings =
                ConfigurationManager.AppSettings;
            return settings.Get(servicename);
        }
  • 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-06-13T02:04:36+00:00Added an answer on June 13, 2026 at 2:04 am

    Here’s your problem:

    NameValueCollection settings = ConfigurationManager.AppSettings;
    return settings.Get(servicename);
    

    Make sure your app.config/web.config has the correct AppSettings values. settings.Get(servicename) isn’t finding a key for servicename.

    So if the servicename is “AwesomeService”, you need an element in appSettings like:

    <add key="AwesomeService" value="somevalue"/>

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

Sidebar

Related Questions

I am getting this exception: The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication
I'm getting this Exception System.InvalidOperationException was unhandled by user code Message=The calling thread cannot
I am getting this exception when trying to save a file: System.Web.HttpException: The SaveAs
I am getting this exception at runtime which says it cannot find a column
I'm getting this exception The process cannot access the file 'myfile.zip' because it is
Any idea why I am getting this exception? Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean
I'm getting this exception from Hibernate building session factory 13:32:09,937 INFO SessionFactoryObjectFactory:105 - Not
i am getting this exception on : chart1.DataBindTable(myReader, Name); here;s the complete code: //
i am getting this exception when try to run as-> maven build .m2\repository\commons-logging\commons-logging\1.1\commons-logging-1.1.jar; cannot
I am getting this exception when trying to run my PHP unit tests: Fatal

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.