Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit Test error - Could not load file or assembly Microsoft.IntelliTrace.Core #128

Open
iamleeky opened this issue Feb 15, 2020 · 8 comments

Comments

@iamleeky
Copy link

Hi,

When I run unit tests, I get this error. Have you seen it and do you know any solution?
I am using Visual Studio 2019 (Version 16.4.5) and FunctionMonkey.Testing package version is 4.0.45-beta.4. (4.0.48-beta.4 has the same error.)
Meanwhile, when I just build and run functions, all is OK.

Detailed Error Message

FunctionApp2.Tests.UnitTest1.Test1
   Source: UnitTest1.cs line 10
   Duration: 1 ms

  Message: 
    FunctionMonkey.TypeLoadingException : ReflectionTypeLoadException: Unable to load one or more of the requested types.
    Could not load file or assembly 'Microsoft.IntelliTrace.Core, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
    Unable to load types:
        Microsoft.VisualStudio.Collector.CollectorUtility
        Microsoft.VisualStudio.TestImpact.Analysis.HResult
        Microsoft.VisualStudio.TestImpact.Analysis.Guids
        Microsoft.VisualStudio.TestImpact.Analysis.IDiaEnumLineNumbers
        Microsoft.VisualStudio.TestImpact.Analysis.IDiaLineNumber
        Microsoft.VisualStudio.TestImpact.Analysis.IDiaSession
        Microsoft.VisualStudio.TestImpact.Analysis.IDiaSourceFile
        Microsoft.VisualStudio.TestImpact.Analysis.SymTagEnum
        Microsoft.VisualStudio.TestImpact.Analysis.IDiaSymbol
        Microsoft.VisualStudio.TestImpact.Analysis.IDiaEnumInjectedSources
        Microsoft.VisualStudio.TestImpact.Analysis.IDiaInjectedSource
        Microsoft.VisualStudio.TestImpact.Analysis.DiaSource
        Microsoft.VisualStudio.TestImpact.Analysis.DiaSourceClass
        Microsoft.VisualStudio.TestImpact.Analysis.DiaSourceObjectClass
        Microsoft.VisualStudio.TestImpact.Analysis.IDiaDataSource
        Microsoft.VisualStudio.TestImpact.Analysis.SymbolReader
        Microsoft.VisualStudio.TestTools.Diagnostics.EqtTrace
        Microsoft.VisualStudio.Coverage.IDynamicCoverageSettings
        Microsoft.VisualStudio.Coverage.Utility
        Microsoft.VisualStudio.Coverage.DynamicCoverageAdvancedSettings
        Microsoft.VisualStudio.Coverage.DynamicCoverageModuleSettings
        Microsoft.VisualStudio.Coverage.DynamicCoverageReadOnlySettings
        Microsoft.VisualStudio.Coverage.SimpleListSettings
        Microsoft.VisualStudio.Coverage.FilteringListSettings
        Microsoft.VisualStudio.Coverage.VanguardException
        Microsoft.VisualStudio.Coverage.ConfigurationEditorUIResource
        Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector
        Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollectorImpl
        Microsoft.VisualStudio.Coverage.UnitTestDataCollector
        Microsoft.VisualStudio.Coverage.Vanguard
        Microsoft.VisualStudio.Coverage.Resources
        Microsoft.VisualStudio.TraceCollector.SimpleTimer
        Microsoft.VisualStudio.TraceCollector.BaseDataCollector
        Microsoft.VisualStudio.TraceCollector.CommonDataCollector
        Microsoft.VisualStudio.TraceCollector.IDataCollectionEvents
        Microsoft.VisualStudio.TraceCollector.IDataCollectionSink
        Microsoft.VisualStudio.TraceCollector.IDataCollectionLogger
        Microsoft.VisualStudio.TraceCollector.IDataCollectionAgentContext
        Microsoft.VisualStudio.TraceCollector.ITestCaseContextEventArgs
        Microsoft.VisualStudio.TraceCollector.DataCollectionEnvironmentContextWrapper
        Microsoft.VisualStudio.TraceCollector.DataCollectionEventsWrapper
        Microsoft.VisualStudio.TraceCollector.DataCollectionSinkWrapper
        Microsoft.VisualStudio.TraceCollector.DataCollectionLoggerWrapper
        Microsoft.VisualStudio.TraceCollector.TestCaseStartEventArgsWrapper
        Microsoft.VisualStudio.TraceCollector.TestCaseEndEventArgsWrapper
        Microsoft.VisualStudio.TraceCollector.ProcessJobObject
        Microsoft.VisualStudio.TraceCollector.TestImpactDataCollector
        Microsoft.VisualStudio.TraceCollector.TestImpactDirectoryWrapper
        Microsoft.VisualStudio.TraceCollector.FileSignature
        Microsoft.VisualStudio.TraceCollector.TestImpactXmlData
        Microsoft.VisualStudio.TraceCollector.Validate
        Microsoft.VisualStudio.TraceCollector.ValidatedNotNullAttribute
        Microsoft.VisualStudio.TraceCollector.FakesAssemblyReflector
        Microsoft.VisualStudio.TraceCollector.HostEnvironment
        Microsoft.VisualStudio.TraceCollector.IFakesAssemblyReflector
        Microsoft.VisualStudio.TraceCollector.SingleAssemblyHost
        Microsoft.VisualStudio.TraceCollector.SingleAssemblyWalker
        Microsoft.VisualStudio.TraceCollector.UnitTestIsolationDataCollector
        Microsoft.VisualStudio.TraceCollector.Resources
        Microsoft.VisualStudio.Collector.CollectorUtility+MachineType
        Microsoft.VisualStudio.TestImpact.Analysis.DiaSourceObjectClass+IClassFactory
        Microsoft.VisualStudio.Coverage.Utility+<FindChildrenByName>d__2
        Microsoft.VisualStudio.Coverage.Utility+<FromSemicolonSeparatedString>d__4
        Microsoft.VisualStudio.Coverage.DynamicCoverageAdvancedSettings+<ToXml>d__45
        Microsoft.VisualStudio.Coverage.DynamicCoverageModuleSettings+<ToXml>d__22
        Microsoft.VisualStudio.Coverage.DynamicCoverageReadOnlySettings+NameElementPair
        Microsoft.VisualStudio.Coverage.DynamicCoverageReadOnlySettings+<ToXml>d__11
        Microsoft.VisualStudio.Coverage.SimpleListSettings+<ToXml>d__15
        Microsoft.VisualStudio.Coverage.FilteringListSettings+FilterType
        Microsoft.VisualStudio.Coverage.FilteringListSettings+<ToXml>d__35
        Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollectorImpl+<>c
        Microsoft.VisualStudio.Coverage.Vanguard+Command
        Microsoft.VisualStudio.TraceCollector.CommonDataCollector+LoggerWrapper
        Microsoft.VisualStudio.TraceCollector.CommonDataCollector+TestInfo
        Microsoft.VisualStudio.TraceCollector.CommonDataCollector+StringContainsIgnoreCaseComparer
        Microsoft.VisualStudio.TraceCollector.CommonDataCollector+<>c
        Microsoft.VisualStudio.TraceCollector.CommonDataCollector+<>c__DisplayClass61_0
        Microsoft.VisualStudio.TraceCollector.CommonDataCollector+<>c__DisplayClass63_0
        Microsoft.VisualStudio.TraceCollector.CommonDataCollector+<>c__DisplayClass63_1
        Microsoft.VisualStudio.TraceCollector.CommonDataCollector+<>c__DisplayClass64_0
        Microsoft.VisualStudio.TraceCollector.CommonDataCollector+<>c__DisplayClass65_0
        Microsoft.VisualStudio.TraceCollector.CommonDataCollector+<>c__DisplayClass65_1
        Microsoft.VisualStudio.TraceCollector.CommonDataCollector+<>c__DisplayClass66_0
        Microsoft.VisualStudio.TraceCollector.CommonDataCollector+<>c__DisplayClass74_0
        Microsoft.VisualStudio.TraceCollector.ProcessJobObject+JobObjectInfoClass
        Microsoft.VisualStudio.TraceCollector.ProcessJobObject+LimitFlags
        Microsoft.VisualStudio.TraceCollector.ProcessJobObject+IoCounters32
        Microsoft.VisualStudio.TraceCollector.ProcessJobObject+IoCounters64
        Microsoft.VisualStudio.TraceCollector.ProcessJobObject+BasicLimits32
        Microsoft.VisualStudio.TraceCollector.ProcessJobObject+BasicLimits64
        Microsoft.VisualStudio.TraceCollector.ProcessJobObject+ExtendedLimits32
        Microsoft.VisualStudio.TraceCollector.ProcessJobObject+ExtendedLimits64
        Microsoft.VisualStudio.TraceCollector.ProcessJobObject+JobObjectInfo
        Microsoft.VisualStudio.TraceCollector.ProcessJobObject+WinAPI
        Microsoft.VisualStudio.TraceCollector.SingleAssemblyWalker+TypeNameCache
        Microsoft.VisualStudio.TraceCollector.SingleAssemblyWalker+UniqueTypeReference
        Microsoft.VisualStudio.TraceCollector.SingleAssemblyWalker+<>c__DisplayClass11_0
        Microsoft.VisualStudio.TraceCollector.UnitTestIsolationDataCollector+<>c
        Microsoft.VisualStudio.TraceCollector.CommonDataCollector+LoggerWrapper+<>c__DisplayClass35_0
        null type in ReflectionTypeLoadException
    With errors:
        FileNotFoundException: Could not load file or assembly 'Microsoft.IntelliTrace.Core, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
    
  Stack Trace: 
    ConfigurationLocator.Find[TType](Assembly assembly)
    ConfigurationLocator.Scan[TType](MethodInfo& linkBackInfo, TType& findConfiguration)
    ConfigurationLocator.Find[TType]()
    ConfigurationLocator.FindFunctionAppHost(Assembly assembly)
    RuntimeInstance.ctor(Assembly functionAppConfigurationAssembly, Action`2 beforeServiceProviderBuild, IServiceCollection serviceCollection)
    AcceptanceTestScaffold.Setup(Assembly functionAppConfigurationAssembly, Action`2 beforeServiceProviderBuild, ILogger mockLogger)
    AbstractAcceptanceTest.ctor()
    UnitTest1.ctor()

My Test File (UnitTest1.cs)

using FunctionMonkey.Testing;
using System;
using Xunit;

namespace FunctionApp2.Tests
{
    public class UnitTest1 : AbstractAcceptanceTest
    {
        [Fact]
        public void Test1()
        {

        }
    }
}

My Project File (FunctionApp2.Tests.csproj)

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>

    <IsPackable>false</IsPackable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="FunctionMonkey.Testing" Version="4.0.48-beta.4" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
    <PackageReference Include="xunit" Version="2.4.1" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="coverlet.collector" Version="1.2.0">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
  </ItemGroup>

</Project>
@mdg215199
Copy link

mdg215199 commented Feb 16, 2020

I just ran into the same issue. You can also replicate the issue in the FunctionMonkey.Testing.Tests project within FunctionMonkey. I believe it's the same issue mentioned here:

microsoft/vstest#2226

According to the notes on the ticket, it should be fixed. Unfortunately, I tried updating latest nuget as well as the preview and still having the issue.

@mdg215199
Copy link

mdg215199 commented Feb 16, 2020

@iamleeky actually, I think i misread the tickets in the vstest repository items. microsoft/vstest#2331

It looks like we'll be waiting until that is resolved.

@iamleeky
Copy link
Author

@mdg215199 I got it. Thank you.

@JamesRandall
Copy link
Owner

Thanks all! I'm on Rider and using xUnit so haven't come across this. If the vstest fix doesn't resolve it let me know.

@iamleeky
Copy link
Author

@JamesRandall Yes, I will.

By the way, is there an official release plan for version 4.x in the near future? Is it ok to use it for production?
I'm considering using Function Monkey for new Web API development in the company I work for.
Thank you so much for your great idea and its awesome architecture.

@mdg215199
Copy link

If it matters, I'm planning to do the same. Overall, pretty happy about giving it a shot. Even more so since the newtonsoft is no longer in the compiler :) That removed a large portion of trying to integrate with other libraries. Also, glad to see mediatr. I'll have to give some feedback on that, as there were two issues that I couldn't do using AzureFromTheTrenaches.Commanding... which, I'll have to go back and take some notes (in case you want to hear feedback and/or want to consider improving). I also want to test it again, as I could have been my stupidity at the time. Either way, will test it again, and will compare it with mediatr (as well as testing it in the functionmonkey integration).

@JamesRandall
Copy link
Owner

It should be ok to use for production now. I am. I'm probably going to move it out of beta in the next couple of weeks but leave the F# and ASP.Net Core support flagging up the experimental warnings while I complete those.

Would love to hear feedback on the commanding too.

@JamesRandall
Copy link
Owner

And thanks for the thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants