none
System ArgumentException :The path is not of a legal form.

    Question

  • I can't figure out why I keep getting this error. I've checked, and I am passing a productID (string) to one of our abstraction functions but then I get an error from a windows method below

    first I make this call, then it blows up:
    -------------------------------------------
    JAAlbum = ProductAbstraction.Load(prAudioID, sstore.EStoreID, out created, TransactionAbstraction.GetTransaction());

    prAudioID looks like this: 'AL2460'

    EStoreID looks like this: 2098

    The Load function looks like this:
    --------------------------------------

                public static Product Load(string EProductID, int EStoreID, out bool Created)
                {
                      return Load(EProductID, EStoreID, out Created, null);
                }
                public static Product Load(string EProductID, int EStoreID, out bool Created, SqlTransaction tran)

                {
                      Product     pr = new Product();
                      if (tran == null)
                    pr.LoadSimpleByStoreAndEProductID(EStoreID, EProductID);
                      else
                            pr.LoadSimpleByStoreAndEProductID(EStoreID, EProductID, tran);
                      if (!pr.IsLoaded)
                      {
                            pr = new Product();
                            pr.EProductID = EProductID;
                            pr.EStoreID = EStoreID;
                            pr.Published = true;
                            pr.ProductSourceID = 1;
                            pr.EllerCommiPercent = .50m;
                            pr.LanguageID = 53;
                            pr.DownloadDeadline = 7;
                            pr.AllowUAsF = false;
                            pr.CopyrightYear = 2007;

                            if (tran == null)
                            {
                                  pr.Save(1);
                            }
                            else
                            {
                                  pr.Save(1, tran);
                            }
                            Created = true;
                      }
                      else
                      {
                            Created = false;
                      }
                      return pr;
                }


    Here's the definition for LoadSimpleByStoreAndSellerProductID

              public void LoadSimpleByStoreAndSellerProductID(int storeID, string sellerProductID)
              {
                   IDataReader dataReader = null;
                   
                   try
                   {
                        // Initialize the database connection
                        Database db = DatabaseFactory.CreateDatabase();     
                        DBCommandWrapper dbCommandWrapper = db.GetStoredProcCommandWrapper("Pr_ProductByStoreAndSellerProductID");
                        
                        dbCommandWrapper.AddInParameter("@EStoreID", DbType.Int32, storeID);
                        dbCommandWrapper.AddInParameter("@EProductID", DbType.String, EProductID);
                        
                        // Grab the desired user's record, if one exists
                        dataReader = db.ExecuteReader(dbCommandWrapper);

                        // If the user exists...
                        if (dataReader.Read()) {
                             // Populate the member variables
                             this.LoadCorePropertiesFromReader(dataReader);
                             this.isLoaded = true;

                             this._emptyObject = false;
                        }
                        else
                             this._emptyObject = true ;
                   }
                   catch(Exception ex)
                   {
                        ExceptionPublisher.Publish(ex, "Company");
                        throw;
                   }
                   finally
                   {
                        if (dataReader != null)
                        {
                             dataReader.Close();
                             dataReader.Dispose();
                        }
                   }          
              }

    Error:

    EE ]20070120 21  37 58 :Error processing the product record. Product skipped. Error:System ArgumentException  :The path is not of a legal form.
       at SysteIO.Path.nGetFullPathHelper(String pat,Char []invalidPathChar, Char[]whitespaceChars ,Char directorySeparato, Char altDirectorySeparat, Char
    volumeSeparator ,Boolean fullCheck,String&newPath  )
       at SysteIO.Path.GetFullPathInterna(String pat)
       at SysteIO.Path.GetFullPath(String pat)
       at SysteXml XmlResolver .ResolveUri(Uri baseUr,String relativeU)i

       at SysteXml XmlTextReader  .ctorString u, XmlNameTable nt )
       at SysteXml XmlTextReader  .ctorString u)l
       at Bl.ConfigConfig.GetValueFromConfig (String ke) in :\Project\1 1\loads\Assemblies\loads\Config\Configcs:line31
       at Bl.Products.Product.ctor()in :\project\1.1\company\assemblies\company\products\product.cs:lin161
       at Bl.Abstraction.ProductAbstraction.Load(String SellerProductI,In32 SellerStoreID,Boolean & Created,SqlTransaction tran)in

    c\projects\1.1\company\assemblies\company.abstraction\productabstraction.csline69
       at Operati.jaOperatio.AddNewProduct   ExcelWrapper xl ,In32 row ,IWorkerDriver host,String FileExtensi,String ProductType ,String FilePa, String
    FileName, Boolean moveFile, SellerStore ssto)in c\projects\11 \company\data impor\jaloade\operation\jaoperati.cs:lin419
       at Operati.jaOperatio.Star(IWorkerDriver host)in :\project\1 1\loads\data impor\jaloade\operatio\jaoperatio.csline325
    Sunday, January 21, 2007 4:02 AM

Answers

  • The config file used by your business layer is throwing the exception.  Here is the relevant call stack information.

      at Bl.ConfigConfig.GetValueFromConfig (String ke) in :\Project\1 1\loads\Assemblies\loads\Config\Configcs:line31

    I'd wager that the path that is being used to identify your config file is bad because the XML reader is failing to load it. 

    Michael Taylor - 1/22/07
    http://p3net.mvps.org


     

    Monday, January 22, 2007 3:30 PM
    Moderator

All replies

  • The config file used by your business layer is throwing the exception.  Here is the relevant call stack information.

      at Bl.ConfigConfig.GetValueFromConfig (String ke) in :\Project\1 1\loads\Assemblies\loads\Config\Configcs:line31

    I'd wager that the path that is being used to identify your config file is bad because the XML reader is failing to load it. 

    Michael Taylor - 1/22/07
    http://p3net.mvps.org


     

    Monday, January 22, 2007 3:30 PM
    Moderator
  • This is the kind of sh** I hate.  When you're on a team, your manager tells you to "ask the other programmers" on a first-time setup of the public site on your local PC.  Meanwhile, fine, you do that...but nobody can remember.

    Hmm, what about putting a fu**ing document on Intranet for our development team that our manager has buy-in to in order to require us "programmers" to update so that we dont' have to rely on geting word of mouth from 5 other programmers on how to simply setup the environment correctly on our machine for a new comer.

    Plus this is SOX compliant.

    Anyway, moral of the story is....Document this sh** so necomers like me dont' have to hit our heads against the wall because we are missing config settings, environment variables and crap like that that is makign our apps blow up!

    It turned out to be a missing environment variable that our base Product class was utilizing when instantiating a new project.

    GO FU**ING FIGURE!  I am missing an environment variable!

    spent and entire weekend on this because we simply cannot put this info in a document so we can all just look at it, set it up, and carry on peacefully.

    Resolved.  Yes, I'm not happy about it.  Some things are that simple, if enforced.  It's not hard to enforce a simple listing of how to setup your PC to whatever application you're working on in a team.  It's not hard to keep that update either.  I hear so many programmers say nobody will update it....that is STUPID and defeats the whole purpose of saving yourself a hassle like this!  This is a simple piece of information people!

    Adios.  Thanks for your help.  I just don't get it sometimes.  We all went to college for what ??  so we can guess on config settings or have to "ask around' to 5 different people till we get all the info~!

    Monday, January 22, 2007 5:10 PM
  • also, in C#, an if statement doesn't need {} if there is no else in it and you are only executing one statement if it validates to true which is completely valid syntax as far as I know
    Monday, January 22, 2007 10:09 PM
  •  FavorFlave wrote:
    also, in C#, an if statement doesn't need {} if there is no else in it and you are only executing one statement if it validates to true which is completely valid syntax as far as I know


    Yep.
    Tuesday, January 23, 2007 9:50 AM
  • also, in C#, an if statement doesn't need {} if there is no else in it and you are only executing one statement if it validates to true which is completely valid syntax as far as I know

    A little OT, but as long as what is immediately following the if statement (at least for VS 2010) is only one line of code, then you don't need the {} (even if the next line is an else statement, as else is treated as a conditional begin-new-code-block).  Therefore, the phraise "if there is no else" can be omitted.

    I use this all the time to make my code easier (for me at least) to read.

    Tuesday, July 17, 2012 12:31 AM