Linq statment can run from visual studio but not after installation
Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1616
Printed Date: 01-Sep-2025 at 1:52am
Topic: Linq statment can run from visual studio but not after installation
Posted By: Suah
Subject: Linq statment can run from visual studio but not after installation
Date Posted: 12-Jan-2010 at 11:23pm
Hi,
I have these code executed in the constructor/Load event handler:
List<StockStruct> _listSS = new List<StockStruct>(); var query = _mgr.Stocks .Where(s => !s.Inactive) .Select(s => new StockStruct { StockCode = s.STOCK_CODE, StockDesc = s.STOCK_DESC, GroupCode = s.StockGroup.CODE, SupplCode = "", Location = s.LOCATION }).ToList<StockStruct>(); _listSS.Clear(); _listSS.AddRange(query);
_listSS is a List<StockStruct>, StockStruct is a class store these information.
This can run fine within Visual Studio, but if the application is installed and distributed and run without visual studio, this statement fails and the constructor failed.
What kind of problems does this code have?
|
Replies:
Posted By: davidklitzke
Date Posted: 13-Jan-2010 at 10:24am
It is not unusual to find that code that runs fine in a development environment (with or without Visual Studio) does not execute properly after the application has been deployed. The most common reason for this is that some library or other piece of code that is present in the development environment is not present in the deployment environment. Another possibility is that some license key is required, and the license key is present in the development environment and absent in the deployment environment.
|
|