CA0001 : Member 'FirstOrDefault' could not be found in type 'System.Linq.Enumerable' in assembly
-
Wednesday, April 25, 2012 9:19 AM
On one of our solutions, with Code Analysis (CA) turned on, we get from time to time (50% of the cases) the same error again and again.
The error is:
Member 'FirstOrDefault' could not be found in type 'System.Linq.Enumerable' in assembly '[mydll].Silverlight, Version=0.0.0.1, Culture=neutral, PublicKeyToken=fdb1b3fc35f0c32e'.
Looking in the .dll.CodeAnalysisLog.xml file:
<Exceptions> <Exception Keyword="CA0001" Kind="AssemblyLoad"> <Type>Microsoft.FxCop.Common.AssemblyLoadException</Type> <ExceptionMessage>Member 'FirstOrDefault' could not be found in type 'System.Linq.Enumerable' in assembly '[mydll].Silverlight, Version=0.0.0.1, Culture=neutral, PublicKeyToken=fdb1b3fc35f0c32e'.</ExceptionMessage> <StackTrace> at Microsoft.FxCop.Engines.Phoenix.LoadAndResolutionHandler.HandleFailureToFindMatch(ModuleUnit unit, String memberName, Type memberType, String className, UInt32 memberRefToken, UInt32 classToken) at Phx.Metadata.ReaderImplementation.GetExternalDefinitionMemberSymbolHelper(UInt32 memberToken, String name, Byte* signature, Symbol parentSymbol, Symbol originalParentSymbol) at Phx.Metadata.ReaderImplementation.GetExternalDefinitionMemberSymbolHelper(UInt32 memberToken, String name, Byte* signature, Symbol parentSymbol, Symbol originalParentSymbol) at Phx.Metadata.LoaderImplementation.GetExternalDefinitionMemberSymbol(UInt32 memberToken) at Phx.Metadata.LoaderImplementation.GetMemberReferenceSymbol(UInt32 memberReferenceToken) at Phx.Metadata.MetadataLoader.LoadMemberReferences(AssemblyUnit unit) at Microsoft.FxCop.Engines.Phoenix.AssemblyLoader.LoadAssembly(String filePath) at Microsoft.FxCop.Engines.Phoenix.PhoenixAnalysisEngine.AnalyzeInternal() at Microsoft.FxCop.Engines.Phoenix.PhoenixAnalysisEngine.Analyze() at Microsoft.FxCop.Common.EngineManager.Analyze(Project project, Boolean verboseOutput)</StackTrace> </Exception> <Exception Keyword="CA0060" Kind="Engine" TreatAsWarning="True"> <Type>Microsoft.FxCop.Sdk.FxCopException</Type> <ExceptionMessage>The indirectly-referenced assembly 'System.Linq.Dynamic.Silverlight, Version=1.0.0.0, Culture=neutral, PublicKeyToken=fdb1b3fc35f0c32e' could not be found. This assembly is not required for analysis, however, analysis results could be incomplete. This assembly was referenced by: C:\Binaries\[mydll2].Silverlight.dll.</ExceptionMessage> </Exception> <Exception Keyword="CA0060" Kind="Engine" TreatAsWarning="True"> <Type>Microsoft.FxCop.Sdk.FxCopException</Type> <ExceptionMessage>The indirectly-referenced assembly 'SL.IdentityModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=fdb1b3fc35f0c32e' could not be found. This assembly is not required for analysis, however, analysis results could be incomplete. This assembly was referenced by: C:\Binaries\[mydll2].Silverlight.dll.</ExceptionMessage> </Exception> </Exceptions>
So it looks like 3 errors, the two CA0060 exceptions can be fixed by adding a reference in the project to the dll's mentioned in the exceptions. But the first error CA0001 still remains.
On the MSDN site (http://msdn.microsoft.com/en-us/library/ms245246.aspx) is mentioned that it could be an error in a custom rule, but i'm not using custom rules.
What could be the problem, and are there some pointers how to fix this?
All Replies
-
Thursday, April 26, 2012 8:02 AMModerator
Then have you check into your code, if the member 'FirstOrDefault' in type 'System.Linq.Enumerable' in assembly '[mydll].Silverlight, Version=0.0.0.1, Culture=neutral, PublicKeyToken=fdb1b3fc35f0c32e'?
Through the error description, it seems that you have a "System.Linq.Enumerable" class in the [mydll].Silerlight.dll assembly, is this right?
If it is, and the problem also cannot solved, then can you create a reproducible project to us, so that we can research into this problem, and help you try to solve it.
You can zip your files, and use the "skydrive".
Mike Zhang[MSFT]
MSDN Community Support | Feedback to us

