I'm using Azure Websites git deploy (via Kudu), and everything has been going great, until today. When I do a new git push, and it tries to deploy, I get this error message while my tests are running:
Error: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.UTFResources, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
I haven't added or removed any libraries or other references from my solution between the last successful push and when I started getting this errors. Googling doesn't turn up anything. That file is in my local GAC, but I can't find it referenced directly anywhere in my solution.
Redeploying an old version of my solution - a version that deployed correctly earlier in the day - fails with the same error message.
If I didn't know better, I'd think that MS changed something on their end and broke kudu.
Any thoughts about troubleshooting this, shy of opening a ticket with Azure?
EDIT - More Details:
It's failing while running the unit tests. Here's the relevant portion of my deploy.cmd:
:: 1. Build to the temporary path
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
%MSBUILD_PATH% "%DEPLOYMENT_SOURCE%\Payboard.Web\Payboard.Web.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="%DEPLOYMENT_TEMP%";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:SolutionDir="%DEPLOYMENT_SOURCE%\.\\" %SCM_BUILD_ARGS%
) ELSE (
%MSBUILD_PATH% "%DEPLOYMENT_SOURCE%\Payboard.Web\Payboard.Web.csproj" /nologo /verbosity:m /t:Build /p:AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:SolutionDir="%DEPLOYMENT_SOURCE%\.\\" %SCM_BUILD_ARGS%
)
IF !ERRORLEVEL! NEQ 0 (
echo Build failed with ErrorLevel !0!
goto error
)
:: 2. Building test projects
rem echo Building test projects
"%MSBUILD_PATH%" "%DEPLOYMENT_SOURCE%\PayboardWeb.sln" /p:Configuration=NoDatabase;VisualStudioVersion=12.0 /verbosity:m /p:Platform="Any CPU"
IF !ERRORLEVEL! NEQ 0 (
echo Build failed with ErrorLevel !0!
goto error
)
:: 3. Running tests
echo Running tests
vstest.console.exe "%DEPLOYMENT_SOURCE%\Payboard.Common.Tests\bin\NoDatabase\Payboard.Common.Tests.dll"
IF !ERRORLEVEL! NEQ 0 goto error
vstest.console.exe "%DEPLOYMENT_SOURCE%\Payboard.Model.Tests\bin\NoDatabase\Payboard.Model.Tests.dll"
IF !ERRORLEVEL! NEQ 0 goto error
vstest.console.exe "%DEPLOYMENT_SOURCE%\Payboard.Services.Tests\bin\NoDatabase\Payboard.Services.Tests.dll"
IF !ERRORLEVEL! NEQ 0 goto error
vstest.console.exe "%DEPLOYMENT_SOURCE%\Payboard.Integrations.Tests\bin\NoDatabase\Payboard.Integrations.Tests.dll"
IF !ERRORLEVEL! NEQ 0 goto error
vstest.console.exe "%DEPLOYMENT_SOURCE%\Payboard.Web.Tests\bin\NoDatabase\Payboard.Web.Tests.dll"
IF !ERRORLEVEL! NEQ 0 goto error
It's failing during the first call to vstest.console.exe, after successfully running a whole bunch of the unit tests, but before finishing. Here's an example of the log file:
Passed ConditionalFormatting_ShouldHandleSimpleConditions
Passed ConditionalFormatting_ShouldHandleComplexNumericConditions
Passed ConditionalFormatting_ShouldHandleNullStrings
Passed ConditionalFormatting_ShouldHandleNullObjects
Error: Exception thrown executing tests in D:\home\site\repository\Payboard.Common.Tests\bin\NoDatabase\Payboard.Common.Tests.dll
Passed ShallowClone_ShouldCopyIntegers
Passed ShallowClone_ShouldCopyNullableIntegers
Error: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.UTFResources, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Passed ShallowClone_ShouldCopyStrings
File name: 'Microsoft.VisualStudio.QualityTools.UTFResources, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Passed ShallowClone_ShouldNotCopyReferences
Passed ShallowClone_ShouldReturnNullIfSourceIsNull
Server stack trace:
Passed ShallowCopyTo_ShouldCopyIntegers
at Microsoft.VisualStudio.TestTools.UnitTesting.ExpectedExceptionAttribute..ctor(Type exceptionType, String noExceptionMessage)
Passed ShallowCopyTo_ShouldCopyNullableIntegers
at Microsoft.VisualStudio.TestTools.UnitTesting.ExpectedExceptionAttribute..ctor(Type exceptionType)
Passed ShallowCopyTo_ShouldCopyStrings
at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
Passed ShallowCopyTo_ShouldNotCopyReferences
at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
Passed ShallowCopyTo_ShouldNotCopyExceptions
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
Passed ShallowCopyTo_ShouldNotCopyExceptionExpressions
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, Boolean inherit)
Passed GetFriendlyTypeName_ShouldHandleSimpleTypes
at System.Reflection.RuntimeMethodInfo.GetCustomAttributes(Boolean inherit)
Passed GetFriendlyTypeName_ShouldHandleComplexTypes
at NUnit.Core.Reflect.GetAttributes(ICustomAttributeProvider member, Boolean inherit)
Passed GetFriendlyTypeName_ShouldHandleReallyComplexTypes
at NUnit.Core.Reflect.HasAttribute(ICustomAttributeProvider member, String attrName, Boolean inherit)
Passed MultiDateTimeConverter_ShouldSupportMultipleFormats
at NUnit.Core.Reflect.HasMethodWithAttribute(Type fixtureType, String attributeName, Boolean inherit)
Passed OrIfGreater_ShouldSelectGreaterValue
at NUnit.Core.Builders.NUnitTestFixtureBuilder.CanBuildFrom(Type type)
Passed OrIfGreater_ShouldSelectRealValue
at NUnit.Core.Extensibility.SuiteBuilderCollection.CanBuildFrom(Type type)
Passed OrIfLesser_ShouldSelectGreaterValue
at NUnit.Core.TestFixtureBuilder.CanBuildFrom(Type type)
Passed OrIfLesser_ShouldSelectRealValue
at NUnit.Core.Builders.TestAssemblyBuilder.GetFixtures(Assembly assembly, String ns)
Passed GetKey_ShouldSupportStrings
at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites)
Passed GetKey_ShouldSupportInts
at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites)
Passed GetKey_ShouldSupportDates
at NUnit.Core.TestSuiteBuilder.BuildSingleAssembly(TestPackage package)
Passed ForEachParallel_ShouldExecuteAllActions
at NUnit.Core.TestSuiteBuilder.Build(TestPackage package)
Passed ForEachParallel_ShouldExecuteWithMaxParallelization
at NUnit.Core.SimpleTestRunner.Load(TestPackage package)
Passed SelectParallel_ShouldSelectAllData
at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
Passed SelectParallel_ShouldSelectWithMaxParallelization
at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
Passed SortOfMatches_ShouldMatchSameUrls
at NUnit.Core.RemoteTestRunner.Load(TestPackage package)
Passed SortOfMatches_ShouldIgnoreQueryStrings
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
Passed SortOfMatches_ShouldIgnoreShortPrefixes
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
Passed SortOfMatches_ShouldNotMatchOnPathMismatch
Passed SortOfMatches_ShouldNotMatchOnHostMismatch
Exception rethrown at [0]:
Passed MainDomain_ShouldRemoveWww
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
Passed MainDomain_ShouldRemoveApp
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
Passed MainDomain_ShouldNotRemoveExample
at NUnit.Core.TestRunner.Load(TestPackage package)
Passed MainDomain_ShouldNotRemoveMainDomain
at NUnit.Util.TestDomain.Load(TestPackage package)
Passed MainDomain_ShouldHandleCountryDomains
at NUnit.VisualStudio.TestAdapter.NUnitTestExecutor.RunAssembly(String assemblyName, ITestExecutionRecorder testLog, TestFilter filter, IRunContext runContext)
Total tests: 117. Passed: 116. Failed: 0. Skipped: 1.
Test execution time: 7.5134 Seconds
An error has occurred during web site deployment.
Test Run Failed.
I should note that if I comment out the calls to the unit tests, I can get it to deploy. So I suppose the question is basically - what can I do to get my unit tests running again? Is it possible that the recent update to the Azure websites - the one that supported, among other things, TypeScript 1.1 - could have possibly removed Microsoft.VisualStudio.QualityTools.UTFResources.dll from the GAC? Or something along those lines?
Have a look here:
https://developercommunity.visualstudio.com/content/problem/35104/systemiofilenotfoundexception-utfresourcesdll.html
The suggestion was to de-reference Microsoft.VisualStudio.QualityTools.UnitTestFramework and add NuGet packages MSTest.TestFramework and MSTest.TestAdapter
On my VSTS build definition, I also had to change the checkout process to clean the All Build Directories
This solved the FileNotFound exception I was getting for the same DLL.
As discussed in the comments, this does appear to be a recent regression. I have opened https://github.com/projectkudu/kudu/issues/1370 to track it and discussed further.
I just lower down the version from 10.1.0.0 to 10.0.0.0. and it worked!!!
Related
I'm using Unit Test Explorer and Unit Test Sessions to run my tests and suddenly get the below error.
When running in Test -> Test explorer, the tests do not run at all and I see no errors.
In both cases there is nothing in Output window. I've reinstalled R#, cleared VS cache (in %USERPROFILE%\AppData\Local\Microsoft), restarted windows, restarted VS.
2019.10.25 14:54:08.058 ERROR Remote: An exception occurred while invoking executor 'executor://mstestadapter/v2': Method not found: 'Void Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.set_CancellationTokenSource(System.Threading.CancellationTokenSource)'.
--- EXCEPTION #1/1 [LoggerException]
Message = “Remote: An exception occurred while invoking executor 'executor://mstestadapter/v2': Method not found: 'Void Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.set_CancellationTokenSource(System.Threading.CancellationTokenSource)'.”
ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
HResult = COR_E_APPLICATION=80131600
StackTraceString = “
at JetBrains.ReSharper.UnitTesting.MSTest.Provider.New.TestHost.TestHostMsTestRunner.TestExecutionEventHandler.HandleLogMessage(TestMessageLevel level, String message)
at Microsoft.TestPlatform.VsTestConsole.TranslationLayer.VsTestConsoleRequestSender.SendMessageAndListenAndReportTestResults(String messageType, Object payload, ITestRunEventsHandler eventHandler, ITestHostLauncher customHostLauncher)
(...)
I've updated the NuGet packages MSTest.TestAdapter and MSTest.TestFramework to the newest version (v2.0.0) in the whole solution and the problem was solved.
We've tried to run next command:
MSBuild.exe ..\src\YaccConstructor.WithoutTests.sln /t:Build /m:8 /v:q /p:Optimize="True" /p:DebugSymbols="True" /p:Configuration="Release" /logger:Fake.MsBuildLogger+TeamCityLogger,"C:\Users\User\Documents\Project\recursive-ascent\tools\Build.Tools\Fake\FakeLib.dll" /logger:Fake.MsBuildLogger+ErrorLogger,"C:\Users\User\Documents\Project\recursive-ascent\tools\Build.Tools\Fake\FakeLib.dll"
After that we've got the next exception:
MSBUILD : error MSB4166: Child node "6" exited prematurely. Shutting down. Diagnostic information may be found in files in the temporary files directory named MSBuild_*.failure.txt.
In the MSBuild_*.failure.txt is the next information:
System.Runtime.Serialization.SerializationException: Type 'Microsoft.Build.BackEnd.TaskHost' in Assembly 'Microsoft.Build, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable.
at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)
at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder)
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo)
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
at Microsoft.Build.BackEnd.NodePacketTranslator.NodePacketWriteTranslator.TranslateDotNet[T](T& value)
at Microsoft.Build.Shared.LogMessagePacketBase.WriteToStream(INodePacketTranslator translator)
at Microsoft.Build.Shared.LogMessagePacketBase.Translate(INodePacketTranslator translator)
at Microsoft.Build.BackEnd.NodeEndpointOutOfProcBase.PacketPumpProc()
We've see all of the follow information:
Compiler Issue in Windows 7: A generic error occurred in GDI+
error MSB4166: Child node exited prematurely. Shutting down
MSBUILD fails with "The process cannot access the file xxxxx because it is being used by another process." when maxcpucount is greater than 1
And nothing helped.
Anyone knows how to solve this problem?
Try explicitly calling the build with MsBuild 4.0 to rule out version 12.0
Try ruling out the custom loggers by omitting the /logger switches.
Try ruling out parallel builds by commenting out the /M switch.
Try piping the diagnostic output to a separate file and see if you can get more fidelity on the error.
%windir%\Microsoft.NET\Framework\v4.0.30319 ..\src\YaccConstructor.WithoutTests.sln /t:Build /m /v:q /p:Optimize="True";DebugSymbols="True";Configuration="Release" /fl1 /flp1:Verbosity=diag;logfile=msbuild_diag.log
I have a website developed in Sitefinity 6.3 that is deployed on windows Azure (website deployed in Cloud Service). Now I have upgraded the project to sitefinity 7.0 as mentioned on their migration page.
Project upgraded successfully, and I followied the steps to remove & add References, but then I ran the project & it showed me following error:
Assembly 'Telerik.Sitefinity, Version=7.0.5100.0, Culture=neutral, PublicKeyToken=b28c218413bdf563'
uses 'Microsoft.WindowsAzure.ServiceRuntime, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
which has a higher version than referenced assembly
'Microsoft.WindowsAzure.ServiceRuntime, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
Then I installed the Azure SDK version 2.2, then following error was displaying:
Could not load file or assembly 'msshrtmi' or one of its
dependencies. An attempt was made to load a program with an incorrect
format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.BadImageFormatException: Could not load file or assembly 'msshrtmi' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'msshrtmi' could not be loaded.
=== Pre-bind state information ===
LOG: DisplayName = msshrtmi
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: msshrtmi | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/user/Projects/TestTime/Code/From Svn/Unpublished/TestTime/
LOG: Initial PrivatePath = C:\user\Projects\TestTime\Code\From Svn\Unpublished\TestTime\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\user\Projects\TestTime\Code\From Svn\Unpublished\TestTime\web.config
LOG: Using host configuration file: C:\Users\Administrator\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\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:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/eaa8f4f5/4dd032f8/msshrtmi.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/eaa8f4f5/4dd032f8/msshrtmi/msshrtmi.DLL.
LOG: Attempting download of new URL file:///C:/user/Projects/TestTime/Code/From Svn/Unpublished/TestTime/bin/msshrtmi.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
Stack Trace:
[BadImageFormatException: Could not load file or assembly 'msshrtmi' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +16
System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38
[ConfigurationErrorsException: Could not load file or assembly 'msshrtmi' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +752
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +218
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +285
System.Web.Compilation.BuildManager.ExecutePreAppStart() +153
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516
[HttpException (0x80004005): Could not load file or assembly 'msshrtmi' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.HttpRuntime.FirstReques
I tried setting following tag in web.config :
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.WindowsAzure.ServiceRuntime" culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-2.3.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
</assemblyBinding
I also copied the related dlls in bin folder & added reference to project.
But nothing seemed to work for me, Please let me know where am I going wrong?
Edit: ------------------------
Thanks [DrewG] for sharing important info.
I followed all the steps as DrewG mentioned. Then I got error when I ran the project in Visual Studio for Post Build task, then I removed that task & Changed following setting in web.config:
<bindingRedirect oldVersion="0.0.0.0-2.3.0.0" newVersion="2.2.0.0"/>
to
<bindingRedirect oldVersion="0.0.0.0-2.5.0.0" newVersion="2.2.0.0"/>
Then it run perfectly, Then I removed the References folder, then It also run perfectly.
Now, I could not recognise wht was fixed by DrewG's steps, but after reverting all the steps it's working correct. I would like to know what might be fixed?
Thanks
I had a similar problem caused from running the project locally. It's trying to load the 64 bit version of that dll (msshrtmi.dll).
Azure is wanting the 64 bit version of the .dll but you either need to use the 32bit version when you run locally or you need to setup a site in IIS with a 64bit app pool to be able to test locally.
I came up with a bit of a hack to get this to work on our azure sites but it has been working before and after an upgrade to Sitefinity 7 so maybe it will help you out.
I copied the 64bit and 32bit msshrtmi.dll files to a folder named References in the same directory as the .sln file. Then I wrote a quick .bat file and added it as a Post Build Task for the project that passes my current build profile.
Note: I have a Build profile with the name "Azure" that I use to update some other settings rather than using Thunder. The Azure build profile is basically just a copy of Release, but I like to test Release builds locally too.
Build task looks like this
call $(SolutionDir)References\AZURE.bat $(ConfigurationName) $(SolutionDir)
AZURE.bat file looks like this
If %1 == Azure echo "Copying 64bit version of msshrtmi.dll"
If %1 == Azure copy %2\References\64\msshrtmi.dll %2\YourProject\Bin\msshrtmi.dll
If NOT %1 == Azure echo "Copying 32bit version of msshrtmi.dll"
If NOT %1 == Azure copy %2\References\32\msshrtmi.dll %2\YourProject\Bin\msshrtmi.dll
I am running a simple Map/Reduce job on Azure HDInsight (Hadoop). The mapper fails with the following error (from the JobTracker log)...
2014-03-27 16:42:50,330 INFO org.apache.hadoop.mapred.TaskInProgress: Error from attempt_201403262112_0004_m_000000_0: java.lang.RuntimeException: PipeMapRed.waitOutputThreads(): subprocess failed with code 255
at org.apache.hadoop.streaming.PipeMapRed.waitOutputThreads(PipeMapRed.java:362)
at org.apache.hadoop.streaming.PipeMapRed.mapRedFinished(PipeMapRed.java:576)
at org.apache.hadoop.streaming.PipeMapper.close(PipeMapper.java:135)
at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:57)
at org.apache.hadoop.streaming.PipeMapRunner.run(PipeMapRunner.java:36)
at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:429)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:365)
at org.apache.hadoop.mapred.Child$4.run(Child.java:266)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1233)
at org.apache.hadoop.mapred.Child.main(Child.java:260)
I am connecting to the cluster using the Hadoop.Connect method...
// Connect to the HDInsight cluster
var hadoop = Hadoop.Connect(hadoopClusterUri,
hadoopUserName,
localHadoopUser,
hadoopPassword,
asvAccount,
asvKey,
asvContainer,
createContinerIfNotExist);
Since the job is started and logged I assume the connection is successful. As a simple test, I am emitting a tiny amount of data...
context.EmitKeyValue("This is a key", "This is a value");
Completely stumped,
Bill
Update
This MapReduce spawns two jobs. This first completes successfully and the second fails with the following exception...
Unhandled Exception: Microsoft.Hadoop.MapReduce.StreamingException: The user type could not be loaded. DLL=MapReduce.exe, Type=PrescienceRx.MapReduce.BeneficiaryMapper ---> System.BadImageFormatException: Could not load file or assembly 'file:///c:\apps\temp\hdfs\mapred\local\taskTracker\admin\jobcache\job_201403262112_0006\attempt_201403262112_0006_m_000001_0\work\MapReduce.exe' or one of its dependencies. An attempt was made to load a program with an incorrect format.
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at Microsoft.Hadoop.MapReduce.MapperMain.Main()
--- End of inner exception stack trace ---
at Microsoft.Hadoop.MapReduce.MapperMain.Main()
at Microsoft.HdInsight.MapDriver.Program.Main(String[] args
It looks like System.BadImageFormatException: Could not load file or assembly is probably because of a mismatch between the loader's .Net version and your assembly. Try setting it back to 4.0 and then in the NuGet Package Manager Window do update-package -reinstall Microsoft.Hadoop.MapReduce to make sure you have all of the correct versions.
I set the target CPU to x64 in the solution's configuration manager and that resolved the issue.
I have a problem starting a Web Application of mine, which runs under IIS 8.
The 'yellow screen of death' states this:
Could not load file or assembly 'RegexAssemblyBuilder, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b40604c47d15475b' or one of its dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'RegexAssemblyBuilder, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b40604c47d15475b' or one of its dependencies. The system cannot find the file specified.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'RegexAssemblyBuilder, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b40604c47d15475b' could not be loaded.
=== Pre-bind state information ===
LOG: User = IIS APPPOOL\XYZweb
LOG: DisplayName = RegexAssemblyBuilder, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b40604c47d15475b
(Fully-specified)
LOG: Appbase = file:///C:/Code/Application/XYZ 4-Web/ABC.XYZ.Web/
LOG: Initial PrivatePath = C:\Code\Application\XYZ 4-Web\ABC.XYZ.Web\bin
Calling assembly : ABC.RegularExpressions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=f59eabe05cc67589.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Code\Application\XYZ 4-Web\ABC.XYZ.Web\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: RegexAssemblyBuilder, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b40604c47d15475b
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
Stack Trace:
[FileNotFoundException: Could not load file or assembly 'RegexAssemblyBuilder, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b40604c47d15475b' or one of its dependencies. The system cannot find the file specified.]
System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0
System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +371
System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +19
System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +319
System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) +203
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +1179
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +146
WebActivator.AssemblyExtensions.GetActivationAttributes(Assembly assembly) +114
WebActivator.ActivationManager.RunActivationMethods() +286
WebActivator.ActivationManager.RunPreStartMethods() +38
WebActivator.ActivationManager.Run() +56
[InvalidOperationException: The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Could not load file or assembly 'RegexAssemblyBuilder, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b40604c47d15475b' or one of its dependencies. The system cannot find the file specified..]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +12880923
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +12880632
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +240
System.Web.Compilation.BuildManager.ExecutePreAppStart() +152
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1151
[HttpException (0x80004005): The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Could not load file or assembly 'RegexAssemblyBuilder, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b40604c47d15475b' or one of its dependencies. The system cannot find the file specified..]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12880068
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12721257
Now, I do have this RegexAssemblyBuilder.exe file in my solution and if I paste it into the bin folder and refresh the page everything works. It is also very likely that there is some issue about the calling assembly which looks for this file, and I have already informed my colleagues about that (I didn't develop it...). In the meantime, to make it work, and for future knowledge, I would like to know if there is the chance to tell IIS not to resolve this binding (which by the way I never use). I can't remove the calling .dll though.
Thank you
You could just set the Build Action to Content and then set Copy To Output Directory to Copy Always to have this assembly added to the bin directly at all tiimes. Otherwise, you could remove the reference to the executable from the project properties, or check to make sure that there is no mention of it in the web.config file. There is no method to prevent IIS from binding to an assembly when it is referenced inside a project. IIS builds up all the referenced assemblies when it does its initial compilation on the first request of the application.