我有一个域对象的集合。它被称为company.xpo.domain(由最初命名该项目的承包商命名,它们与我们相比更长 - 我们拥有该软件)。我对命名空间进行了全局重命名为xpo.domain,并将设计器中的默认命名空间更改为xpo.domain。
我也在视觉工作室找到了关于“公司”整个解决方案的发现,但没有找到任何结果。
我的问题是这样的:
在程序集中有一个用户对象,它有一个静态方法“Login”,它接受用户名和密码,检查db的名称/密码,如果没有找到则返回null。
在这个静态方法中,它会为company.xpo.domain程序集抛出一个FileNotFoundException。这让我感到困惑,因为抛出异常的代码存在于它正在寻找的程序集中(但它正在查找程序集的先前名称)。
修改 这是堆栈跟踪。为了安全起见,我刚刚对软件名称和程序集名称进行了重命名。
System.IO.FileNotFoundException occurred
Message="Could not load file or assembly 'company.XPO.domain' or one of its dependencies. The system cannot find the file specified."
Source="mscorlib"
FileName="company.XPO.domain"
FusionLog="=== Pre-bind state information ===
LOG: User = STOONP001\\Administrator
LOG: DisplayName = company.XPO.domain\n (Partial)
LOG: Appbase = file:///C:/Documents and Settings/Administrator/Desktop/softwareName/softwareName/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : DevExpress.Data.v9.2, Version=9.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\\Documents and Settings\\Administrator\\Desktop\\softwareName\\softwareName\\bin\\Debug\\softwareName.vshost.exe.config
LOG: Using machine configuration file from c:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\config\\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator/Desktop/softwareName/softwareName/bin/Debug/company.XPO.domain.DLL.
LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator/Desktop/softwareName/softwareName/bin/Debug/company.XPO.domain/company.XPO.domain.DLL.
LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator/Desktop/softwareName/softwareName/bin/Debug/company.XPO.domain.EXE.
LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator/Desktop/softwareName/softwareName/bin/Debug/company.XPO.domain/company.XPO.domain.EXE."
StackTrace:
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
InnerException
编辑2
如果有帮助,调用堆栈就在这里。似乎看起来devexpress.data.utils抛出错误,但我无法控制该类(如果它实际上是该程序集的问题)。
mscorlib.dll!System.Reflection.Assembly.nLoad(System.Reflection.AssemblyName fileName, string codeBase, System.Security.Policy.Evidence assemblySecurity, System.Reflection.Assembly locationHint, ref System.Threading.StackCrawlMark stackMark, bool throwOnFileNotFound, bool forIntrospection) + 0x2c bytes
mscorlib.dll!System.Reflection.Assembly.LoadWithPartialNameInternal(string partialName, System.Security.Policy.Evidence securityEvidence = null, ref System.Threading.StackCrawlMark stackMark = LookForMyCaller) + 0x6b bytes
mscorlib.dll!System.Reflection.Assembly.LoadWithPartialName(string partialName) + 0x1b bytes
DevExpress.Data.v9.2.dll!DevExpress.Data.Utils.Helpers.LoadWithPartialName(string partialName = "company.XPO.domain") + 0x1f bytes
DevExpress.Data.v9.2.dll!DevExpress.Xpo.Helpers.XPTypeActivator.GetType(string assemblyName = "company.XPO.domain", string typeName = "company.XPO.domain.customer") + 0xd0 bytes
DevExpress.Xpo.v9.2.dll!DevExpress.Xpo.Metadata.ReflectionDictionary.ResolveClassInfoByName(string assemblyName = "company.XPO.domain", string typeName = "company.XPO.domain.customer") + 0x50 bytes
DevExpress.Xpo.v9.2.dll!DevExpress.Xpo.Metadata.ReflectionDictionary.QueryClassInfo(string assemblyName = "company.XPO.domain", string className = "company.XPO.domain.customer") + 0xde bytes
DevExpress.Xpo.v9.2.dll!DevExpress.Xpo.XPObjectType.TypeClassInfo.get() + 0x55 bytes
DevExpress.Xpo.v9.2.dll!DevExpress.Xpo.XPObjectType.IsValidType.get() + 0x1f bytes
DevExpress.Xpo.v9.2.dll!DevExpress.Xpo.Helpers.XPObjectTypesManager.FillLoadedTypes(System.Collections.ICollection objectTypesList = Count = 23) + 0xfa bytes
DevExpress.Xpo.v9.2.dll!DevExpress.Xpo.Helpers.XPObjectTypesManager.GetAllTypes() + 0x278 bytes
DevExpress.Xpo.v9.2.dll!DevExpress.Xpo.Helpers.XPObjectTypesManager.EnsureIsTypedObjectValid() + 0x1e bytes
DevExpress.Xpo.v9.2.dll!DevExpress.Xpo.Helpers.ObjectCollectionLoader.InternalLoadData(DevExpress.Xpo.ObjectsQuery[] queries = {DevExpress.Xpo.ObjectsQuery[1]}) + 0x5a bytes
DevExpress.Xpo.v9.2.dll!DevExpress.Xpo.Helpers.ObjectCollectionLoader.LoadObjects(DevExpress.Xpo.ObjectsQuery[] queries = {DevExpress.Xpo.ObjectsQuery[1]}) + 0xda bytes
DevExpress.Xpo.v9.2.dll!DevExpress.Xpo.Session.GetObjects(DevExpress.Xpo.ObjectsQuery[] queries = {DevExpress.Xpo.ObjectsQuery[1]}) + 0x58 bytes
DevExpress.Xpo.v9.2.dll!DevExpress.Xpo.Session.GetObjects(DevExpress.Xpo.ObjectsQuery query = {DevExpress.Xpo.ObjectsQuery}) + 0x55 bytes
DevExpress.Xpo.v9.2.dll!DevExpress.Xpo.Session.GetObjects(DevExpress.Xpo.Metadata.XPClassInfo classInfo = {XPO.domain.sys_user}, DevExpress.Data.Filtering.CriteriaOperator criteria = {[Username] = 'username' And [Password1] = 'password'}, DevExpress.Xpo.SortingCollection sorting = null, int topSelectedRecords = 1, bool selectDeleted = false, bool force = false) + 0x9b bytes
DevExpress.Xpo.v9.2.dll!DevExpress.Xpo.Session.InternalFindAndLoad(DevExpress.Xpo.Metadata.XPClassInfo baseType = {XPO.domain.sys_user}, DevExpress.Data.Filtering.CriteriaOperator criteria = {[Username] = 'username' And [Password1] = 'password'}, bool selectDeleted = false) + 0x38 bytes
DevExpress.Xpo.v9.2.dll!DevExpress.Xpo.Session.FindObject(DevExpress.Xpo.Metadata.XPClassInfo classInfo = {XPO.domain.sys_user}, DevExpress.Data.Filtering.CriteriaOperator criteria = {[Username] = 'username' And [Password1] = 'password'}, bool selectDeleted = false) + 0x2d bytes
DevExpress.Xpo.v9.2.dll!DevExpress.Xpo.Session.FindObject(System.Type classType = {Name = "sys_user" FullName = "XPO.domain.sys_user"}, DevExpress.Data.Filtering.CriteriaOperator criteria = {[Username] = 'username' And [Password1] = 'password'}, bool selectDeleted = false) + 0x52 bytes
DevExpress.Xpo.v9.2.dll!DevExpress.Xpo.Session.FindObject<XPO.domain.sys_user>(DevExpress.Data.Filtering.CriteriaOperator criteria = {[Username] = 'username' And [Password1] = 'password'}) + 0x57 bytes
注意:我也使用DevExpress创建了一个案例,以防万一。我完全被难过了。
答案 0 :(得分:1)
我肯定需要看到堆栈跟踪和/或代码才能确实知道,但听起来我可能会在程序集中有一些循环引用,其中一个引用旧的程序集。但这完全只是在黑暗中刺伤。
答案 1 :(得分:1)
如果可以,如果适用,我会检查与您可能拥有的任何类型化数据集关联的代码;我在Typed DataSet类中重命名命名空间时遇到了问题。我必须进去,不得不手动“搜索和替换”。
同样,这对你来说可能并不适合。
编辑 -
另一种可能性:
您的GAC中是否有可能通过名称引用旧程序集?