I've got an assembly of domain objects. It WAS called company.xpo.domain (it was named that by the contractor that initially named the project, and they are longer with us - we own the software). I did a global rename of the namespace to xpo.domain and I changed the default namespace in the designer to xpo.domain.
I also did a find in visual studio on the entire solution for "company" and found nothing.
My problem goes like this:
in the assembly there is a user object that has a static method "Login" which takes a username and a password, checks the db for the name/password and returns null if nothing was found.
IN THAT STATIC METHOD, it throws a FileNotFoundException for the company.xpo.domain assembly. This is confusing to me because, the code that's throwing the exception, exists in the assembly that it's looking for (but it's looking for the previous name of the assembly).
EDIT Here is the stack trace. I've just done a rename on the name of the software and the name of the assembly for the purpose of security.
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
EDIT 2
The call stack, if it helps, is here. It seems to appear that devexpress.data.utils is throwing the error, but I have no control over that class (if it is in fact a problem with that assembly).
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.M开发者_运维百科etadata.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
Note: I have created a case with DevExpress as well, just in case. I'm totally stumped.
I would definitely need to see a stack trace and/or code to really know for sure, but it sounds to me like you might have some kind of circular reference in your assemblies and one of them is referencing your old assembly. But that's completely just a stab in the dark.
If you can and if applicable, I'd check the code associated with any Typed DataSets you might have; I've had had problems renaming namespaces within Typed DataSet classes. I've had to go in and had to do 'search and replaces' manually.
Again, this may not be revelant for you.
Edit--
Another possibility:
Any chance there's something in your GAC that references the old assembly by name?
精彩评论