I have a Windows Phone 7.1 (Mango) application that was using JSON.NET 4.0.2.
I upgraded it to 4.0.3 and now I get all kinds of error.
A deserialized class that was working before is now throwing this error :
Could not load type 'System.Dynamic.IDynamicMetaObjectProvider' from assembly 'System.Core, Version=3.7.0.0, Culture=neutral, PublicKeyToken=969DB8053D3322AC'.
I also make use of the Linq feature by using JArray and now I get this message:
{"Could not load type 'Newtonsoft.Json.Linq.JArray' from assembly 'Newtonsoft.Json, Version=4.0.3.0, Culture=neutral, PublicKeyToken=30AD4FE6B2A6AEED'."}
I tried cleaning the solution. I tried copying the DLLs one more time.
Any suggestions?
The problem is that Windows Phone 7.1 defaults to the Silverlight 4 build if no explicit Silverlight 4 WP build is specified. Silverlight 4 has features that aren't available on WP which is why this causes Json.NET to break.
This will be fixed in 4.0.5 by having the current Windows Phone 7.0 dll used for 7.1 but for now to fix the problem just change the dll reference to the Newtonsoft.Json.dll file in the sl3-wp directory.
Related
I am using Microsoft.Data.SqlClient in .NET 6 function app or console app
I got this exception break on this line of code using (SqlConnection connection = new SqlConnection(connectionString)), it seems it only throw this exception in debugging mode, I remembered the same code was okay in .NET Core 3.1 or early .NET 6, this behavior showed up recently and looks like it try to find the resource file for English language ... anyone know how to solve this problem?
System.IO.FileNotFoundException
HResult=0x80070002
Message=Could not load file or assembly 'Microsoft.Data.SqlClient.resources, Version=5.0.0.0, Culture=en-US, PublicKeyToken=23ec7fc2d6eaa4a5'. The system cannot find the file specified.
We have installed CerfSharp using the NuGet Pakage Manager and created a class library which loads a ChromiumWebBrowser, it works fine on VisualStudio-2019,
When we deployed the class library(DLL) into target location along with required cefsharp supported files as mentioned the readme.txt, which throws following exception
Error Message: Could not load file or assembly 'CefSharp.Core.Runtime.DLL' or one of its dependencies. The specified module could not be found.
Stack Trace: at CefSharp.Cef.get_IsInitialized()
could anyone help us on this issue?
Added following cefsharp supported files in the target deployment location:
CEF core library.
libcef.dll
Crash reporting library.
chrome_elf.dll
Unicode support data.
icudtl.dat
V8 snapshot data.
snapshot_blob.bin
v8_context_snapshot.bin
[System Info]:
CefSharp Version=91.1.230.0
OS: Windows 7 x64
Visual Studio Version:
Microsoft Visual Studio Enterprise 2019
Version 16.7.8
.NET Framework: 4.8
Thanks,
I am having a problem that many people have had before but none of the existing answers seem to work for me.
When I deploy my ASP.NET project I get an error in the event log saying
Could not load file or assembly 'Microsoft.SqlServer.Types, Version=13.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
To try to rectify this I installed the Nuget package:
PM> Install-Package Microsoft.SqlServer.Types
This didn't work and I get the same error. So then I followed the readme and used Loader.cs to load the files. Again, same problem. What is happening and why don't the usual solutions fix it?
One thing I did note is that my Microsoft.SqlServer.Types.dll is version 11 not 13? If it makes any difference our database is SqlServer 2016 and our machine is running Windows Server 2008
The way I solved this was to to set the SqlServerTypesAssemblyName in my app. I currently set it in my EntityContext constructor [that inherits off DbContext] to ensure its always set
SqlProviderServices.SqlServerTypesAssemblyName
= "Microsoft.SqlServer.Types, Version=13.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91";
Note your version may want to be different.
Make sure you are reference the correct version of assembly.
If not add manually.
Once the nuget package is installed you can ensure that the dll reference property is set to 'copy local = true'
I know that it was mentioned JSON.NET will work on WP Mango 7.1 in 4.0.5, and to use 3.x for now, however this is not working for me as 4.x was... It's not handling deserialization the same way for some reason, so I'm wondering if there's a way that I can build 4.0.4 from source to work on 7.1 now, without getting the Deserialization error:
Could not load type 'System.Dynamic.IDynamicMetaObjectProvider' from assembly 'System.Core, Version=3.7.0.0, Culture=neutral, PublicKeyToken=969DB8053D3322AC'.
See my answer here - Moving to JSON.NET 4.0.3 broke my app
Quick solution - change the dll reference from the SL build to SL3-wp
I developed a .Net 3.5 x64 web application that includes a custom HttpHandler in the config:
<add path="*.class1" verb="GET" type="ClassLibrary1.Class1Handler"/>
This works when the platform target for ClassLibrary1 is set at x86.
However, when I set this to x64 I get the following error when I run web application starts (it compiles just fine):
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Does this mean that a HttpHandler can be compiled at x86 only?
That doesn't make much sense to me.
Does anyone have an idea of what could be going on?
Edit 1:
The ClassLibrary1 project is just an empty class library project with a single HttpHandler added (which is also empty).
Edit 2:
I am also getting these warning messages when compiling, I am pretty sure they have something to do with this problem:
Assembly generation -- Referenced assembly 'mscorlib.dll' targets a different processor HttpTest
Edit 3:
I manually edited the project file to force references to the x64 assemblies, like this:
<Reference Include="$(Windir)\Microsoft.NET\Framework64\v2.0.50727\System.dll"/>
This does supress the above warning message, but the problem isn't resolved.
Thanks!
You probably compiled your assembly ClassLibrary1 with the attribute x86. Try to compile it with AnyCPU tag.
One of your dependent assemblies is compiled with the flag set to x86 rather than AnyCPU or x64
See this page for how to use the coreflags.exe to query the assebly in question