ServiceStack.text not Load file System.Memory - servicestack

Good morning,
we are developing a dll that uses ServiceStack.Text.dll (5.4).
The installation in the project was done via nuget.
Locally the application works fine while on a server machine it has problems.
The following error occurs when loaded into memory and run on in Windows Server 2012 r2 standard .
We have the following error:
System.TypeInitializationException: The type initializer for 'ServiceStack.Text.TypeSerializer' threw an exception. ---> System.TypeInitializationException: The type initializer for 'ServiceStack.Text.JsConfig' threw an exception. ---> System.IO .FileNotFoundException: Could not load file or assembly 'System.Memory, Version = 4.0.1.0, Culture = neutral, PublicKeyToken = cc7b13ffcd2ddd51' or one of its dependencies.
The system cannot find the file specified.
But in our build folder the indicated system.memory is available and also its dependencies.
Do you have any suggestions?

You'll likely need an Assembly Binding in your Web.Config (or App.Config for non Web Apps) to reference the version of System.Memory your project has referenced, something like:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Memory"
publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>

Related

Test error :Could not load file or assembly 'Castle.Core, Version=4.0.0.0, Culture=neutral

I installed the free startup template of ASP.NET Boilerplate with the architecture Asp.Net Mvc5.x and Single Page Web Application Angular JS
and when I run the already added test to template as an example which is called Should_Get_Current_User_And_Tenant_When_Logged_In_As_Tenant() which is found in the project
SpecificDownloadedProjectName.Tests
I get the error
Could not load file or assembly 'Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
my current version of castle.core is v4.3.1
and of Abp 3.8.3
and these versions are the last latest available ones in NuGet packages
I tried to update Castle.core via NuGet Package Manager to be 4.0.0 as the exception message mentions but I couldn't with the following error
Severity Code Description Project File Line Suppression State
Error Unable to resolve dependencies. 'Castle.Core 4.0.0' is not compatible with 'Abp 3.8.3 constraint: Castle.Core (>= 4.3.1)', 'Castle.Core-log4net 4.3.1 constraint: Castle.Core (= 4.3.1)', 'Castle.DynamicProxy 2.2.0 constraint: Castle.Core (= 1.2.0)'. 0
what should I do in order to resolve this exception
This is the issue with the Nuget, it doesn't resolve it sometime, so you have to manually add the below lines in the web.config or app.config. You have to make sure the order of the lines also.
<dependentAssembly>
<assemblyIdentity name="Castle.Core" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.0.0.0" />
</dependentAssembly>
Note: You can set the oldVersion and newVersion values as per the requirement.

System.MissingMethodException: Method not found: 'Microsoft .FSharp.Core.FSharpFunc`2

I've got a problem when launching a Canopy test in a Windows box:
Unhandled Exception: System.MissingMethodException: Method not found: 'Microsoft
.FSharp.Core.FSharpFunc`2<System.String,System.String> canopy.core.get_xpath()'.
at <StartupCode$UITest>.$Program.main#()
I guess this is because when compiling it, my Visual Studio 2012 restored Nuget packages and spitted this in the console output:
Consider app.config remapping of assembly "FSharp.Core, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.3.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\3.0\Runtime\v4.0\FSharp.Core.dll] to Version "4.4.0.0" [C:\Users\Andres\Documents\Code\endtoendtests\packages\FSharp.Core.4.0.0.1\lib\net40\FSharp.Core.dll] to solve conflict and get rid of warning.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly.
C:\Program Files (x86)\Microsoft SDKs\F#\3.0\Framework\v4.0\fsc.exe -o:obj\x86\Debug\UITest.exe -g --noframework --define:DEBUG --optimize- --tailcalls- --platform:x86 -r:C:\Users\Andres\Documents\Code\endtoendtests\packages\canopy.0.9.52\lib\canopy.dll -r:C:\Users\Andres\Documents\Code\endtoendtests\packages\FSharp.Core.4.0.0.1\lib\net40\FSharp.Core.dll -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Drawing.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Numerics.dll" -r:C:\Users\Andres\Documents\Code\endtoendtests\packages\Selenium.WebDriver.2.53.0\lib\net40\WebDriver.dll --target:exe --warnaserror:76 --vserrors --validate-type-providers --LCID:1033 --utf8output --fullpaths --flaterrors --highentropyva- "C:\Users\Andres\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.fs" AssemblyInfo.fs Program.fs
UITest -> C:\Users\Andres\Documents\Code\endtoendtests\UITest\bin\Debug\UITest.exe
How to exactly add this remapping to fix this problem?
Managed to get it to work with this App.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="4.3.0.0" newVersion="4.4.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
This must be because I've never installed F#, so that I'm using the version that comes with my VS2012 (v3.0). I know I know, I should upgrade to 3.1, or 4.0 even.

Phalanger error in Visual Studio

I have installed Phalanger from http://phalanger.codeplex.com/ and installed Phalanger Tools from the built-in market-place function in my Visual Studio 2012 Ultimate distribution. After doing this, every time I boot start Visual Studio I get a dialog-box with the error:
If I examine ActivityLog.xml I find the following errors (all other elements omitted):
<?xml version="1.0" encoding="utf-16"?>
<?xml-stylesheet type="text/xsl" href="ActivityLog.xsl"?>
<activity>
<entry>
<record>16</record>
<time>2013/10/04 14:43:55.426</time>
<type>Error</type>
<source>VisualStudio</source>
<description>Loading UI library</description>
<guid>{712C84E3-B447-4283-ABF3-D00B161E63FE}</guid>
<hr>800a006f</hr>
<errorinfo>Cannot find the requested resource.</errorinfo>
</entry>
<entry>
<record>63</record>
<time>2013/10/04 14:44:03.569</time>
<type>Error</type>
<source>VisualStudio</source>
<description>SetSite failed for package [PHP.Project.PHPProjectPackage, PHP.VS, Version=1.8.4608.0, Culture=neutral, PublicKeyToken=17116b35d45f8bb8]</description>
<guid>{9DD0D70B-6760-4C96-B1DC-03AAF937D95A}</guid>
<hr>80004003 - E_POINTER</hr>
<errorinfo>Object reference not set to an instance of an object.</errorinfo>
</entry>
<entry>
<record>64</record>
<time>2013/10/04 14:44:03.574</time>
<type>Error</type>
<source>VisualStudio</source>
<description>End package load [PHP.Project.PHPProjectPackage, PHP.VS, Version=1.8.4608.0, Culture=neutral, PublicKeyToken=17116b35d45f8bb8]</description>
<guid>{9DD0D70B-6760-4C96-B1DC-03AAF937D95A}</guid>
<hr>80004003 - E_POINTER</hr>
<errorinfo>Object reference not set to an instance of an object.</errorinfo>
</entry>
</activity>
Does anyone have a take on what I could do to relieve this?
It seams, you have PHP Tools for Visual Studio, not Phalanger Tools. Also it is possible you installed PHP Tools in addition to Phalanger Tools.
Try to uninstall both, and install Phalanger Tools only.

Linking External dll

I am working with Visual Studio 2012. I am externally "Microsoft.Phone.Controls.Toolkit.dll". The project compiles and works fine when I run in debug mode. However gives me the following error message when I try to compile for release:
Warning 1 Could not resolve this reference. Could not locate the assembly "Microsoft.Phone.Controls.Toolkit, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b772ad94eb9ca604, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. WindowsPhoneNavigationTransitions
How do i solve this issue?

Program initialization failed (0xc0150002) when start a program depend on a third party dll

When I write a c++ program (such as B3DTest.exe) depend on a third party dll(such B3DViews.dll) (the vendor is small company). The program that I wrote is very simple just to test one function in the dll. When I start my program (the needed header file, .lib files and .dll file are linked). I come across the problem below.
The application failed to initialize properly (0xc0150002). Click on OK to terminate
the application.
I find out that the program exit before enter my main function. the out put of the vs2008 IDE is
LDR: LdrpWalkImportDescriptor() failed to probe e:\tlh1987\vs2008projects\B3DTest\Debug\B3DViews.dll
for its manifest, ntstatus 0xc0150002
I put the program and the dll in an other target computer and it works fine. So I think it must be something wrong with my computer. I searched the event log and it says below for three event
EventID: 32
Description: Dependent Assembly Microsoft.VC80.CRT could not be found and Last Error was The referenced
assembly is not installed on your system.
EventID: 59
Description: Resolve Partial Assembly failed for Microsoft.VC80.CRT. Reference error message: The
referenced assembly is not installed on your system.
EventID: 59
Description: Generate Activation Context failed for Generate Activation Context
E:\tlh1987\vs2008projects\B3DTest\Debug\B3DViews.dll. Reference error message: The operation completed
successfully.
I search The Internet to find out that someone fix a similar problem by installing Microsoft Visual C++ 2005 Redistributable Package and the Microsoft Visual C++ 2005 SP1 Redistributable Package (x86).
I download the two files and installed it. However, it couldn't work!
Another solution on the internet is Put the files of Microsoft.VC80.CRT folder which include 3 dll and Microsoft.VC80.MFC folder (also include 4 dll) and finally the correspond manifest files in the dir of B3DTest.exe (my program). However, It still didn't work! But something has changed the event log where there is only 1 event error which says below:
EventID: 59
Description: Generate Activation Context failed for Generate Activation Context
E:\tlh1987\vs2008projects\B3DTest\Debug\B3DViews.dll. Reference error message: The operation completed
successfully.
Somebody told me that may be the version of the VC80.CRT and the VC80.MFC in my computer didn't match the version number in the B3DViews.dll (which is distributed by the vendor). Then I open the B3DViews.dll with emacs.exe and search the manifest attached to the dll. It says below:
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50727.6195"
processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC80.MFC" version="8.0.50727.6195"
processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50608.0"
processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC80.MFC" version="8.0.50608.0"
processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
</assembly>
the version number made me confused. How can it is 8.0.50727.6195 as well as 8.0.50608.0 It think it should be one version number (not two as showed above). I find the Microsoft.VC80.CRT dlls and the Microsoft.VC80.MFC dlls and also the correspond manifest files (all the version numbers is 8.0.50727.6195 in the C:\Windows\WinSxS and put it in the dir the same as B3DTest.exe (my program). It couldn't work either.
In order to figure out the problem. I used the Dependency Walker for Win32 (x86) to profile my program i.e. B3DTest.exe. It says below:
Started "B3DTEST.EXE" (process 0x680) at address 0x00400000. Successfully hooked module.
Loaded "NTDLL.DLL" at address 0x7C920000. Successfully hooked module.
Loaded "KERNEL32.DLL" at address 0x7C800000. Successfully hooked module.
DllMain(0x7C920000, DLL_PROCESS_ATTACH, 0x00000000) in "NTDLL.DLL" called.
DllMain(0x7C920000, DLL_PROCESS_ATTACH, 0x00000000) in "NTDLL.DLL" returned 1 (0x1).
DllMain(0x7C800000, DLL_PROCESS_ATTACH, 0x00000000) in "KERNEL32.DLL" called.
DllMain(0x7C800000, DLL_PROCESS_ATTACH, 0x00000000) in "KERNEL32.DLL" returned 1 (0x1).
Injected "DEPENDS.DLL" at address 0x08370000.
DllMain(0x08370000, DLL_PROCESS_ATTACH, 0x00000000) in "DEPENDS.DLL" called.
DllMain(0x08370000, DLL_PROCESS_ATTACH, 0x00000000) in "DEPENDS.DLL" returned 1 (0x1).
Loaded "B3DVIEWS.DLL" at address 0x10000000. Successfully hooked module.
LDR: LdrpWalkImportDescriptor() failed to probe e:\tlh1987\vs2008projects\b3dtest\debug\B3DViews.dll
for its manifest, ntstatus 0xc0150002
First chance exception 0xC0150002 (Unknown) occurred in "NTDLL.DLL" at address 0x7C9873BE.
**Second chance exception 0xC0150002 (Unknown) occurred in "NTDLL.DLL" at address 0x7C9873BE.**
Exited "B3DTEST.EXE" (process 0x680) with code -1072365566 (0xC0150002).
It drives me crazy. I wan't to figure it out. any help will appreciated!
This(http://www.codeguru.com/forum/showthread.php?t=408061) may help to the problem. But I can not figure it out by reading it.
my system is windows xp sp3 and I using VS2008. I didn't install VS2005.
I figure it out somehow. with the help of this Q&A
http://social.msdn.microsoft.com/Forums/nb-NO/vssetup/thread/fa559cb7-eabc-4f41-a3bc-84ed7ae089fc
first, I uninstalled all the Microsoft Visual C++ 2005 Redistributable Package
second, I installed Microsoft Visual C++ 2005 SP1 Redistributable Package (x86) directly. It didn't work either, but when I installed
Visual C++ 2005 Service Pack 1 Redistributable Package MFC Security Update
It just works. It seems that the Update del the old version of Microsoft Visual C++ 2005 Redistributable Package, then make the new one (the sp1 one) to work.
First, I uninstalled all the Microsoft Visual C++ 2005 Redistributable Package
second, I installed Microsoft Visual C++ 2005 SP1 Redistributable Package (x86) directly. It didn't work either, but when I installed
Visual C++ 2005 Service Pack 1 Redistributable Package MFC Security Update
It just works
0xC0150002L is STATUS_SXS_CANT_GEN_ACTCTX. The tool for debugging activation context issues is SxsTrace. Try this:
touch program.exe
SxsTrace Trace -logfile:SxsTrace.etl
[run program.exe]
SxsTrace Parse -logfile:SxsTrace.etl -outfile:SxsTrace.txt
SxsTrace.txt will contain the name of the assembly that is referenced and can't be found.

Resources