Bug 8540 - Missing method ServiceStack.ServiceModel.Serialization.DataContractDeserializer::.ctor(XmlDictionaryReaderQuotas) when running on mono 3.0
Summary: Missing method ServiceStack.ServiceModel.Serialization.DataContractDeserializ...
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-11-21 09:31 UTC by Pablo Ruiz García
Modified: 2012-11-21 19:44 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test case demostrating the issue. (198.97 KB, application/octet-stream)
2012-11-21 09:31 UTC, Pablo Ruiz García
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Pablo Ruiz García 2012-11-21 09:31:04 UTC
Created attachment 2986 [details]
Test case demostrating the issue.

While upgrading to mono 3.0.1 an application previouslly running on 2.10+ I catch this exception which (apparently) seems related to a .ctor accepting an optional parameter with default value.

I managed to create a really simple test demostrating the issue with the following code:

using System;
using System.Xml;
using ServiceStack.ServiceModel.Serialization;

namespace Test {
        public static class Program {
public static void Main()
{
        DataContractDeserializer.Instance = new DataContractDeserializer(
                new XmlDictionaryReaderQuotas()
                {
                        MaxStringContentLength = 1024 * 1024,
                        MaxArrayLength = 5 * 1024 * 1024
                }
        );

}
        }
}

This code is compiled/executed as follows:

[root@qa test]# dmcs -target:exe -r:System.Runtime.Serialization -r:ServiceStack.Common.dll -r:ServiceStack.Interfaces.dll -out:m.exe m.cs

[root@qa test]# mono m.exe
Missing method ServiceStack.ServiceModel.Serialization.DataContractDeserializer::.ctor(XmlDictionaryReaderQuotas) in assembly /opt/Herma/WebSite/bin/test/ServiceStack.Common.dll, referenced in assembly /opt/Herma/WebSite/bin/test/m.exe

Unhandled Exception:
System.MissingMethodException: Method not found: 'ServiceStack.ServiceModel.Serialization.DataContractDeserializer..ctor'.
[ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method not found: 'ServiceStack.ServiceModel.Serialization.DataContractDeserializer..ctor'.

I'm attaching the tests case along with the required dependency assemblies.
Comment 1 Pablo Ruiz García 2012-11-21 09:33:25 UTC
This might be related to (IKVM) reflection code (not really sure), so I'm adding Marek just in case he might help.
Comment 2 Marek Safar 2012-11-21 10:15:13 UTC
Works for me with mono master.

Perhaps you are using different assembly for compilation and different for execution.
Comment 3 Pablo Ruiz García 2012-11-21 10:24:13 UTC
Dont think so, because the enviroment in which I'm executing the provided test case is a clean VM with nothing at GAC except for mono's assemblies.

So there is only a single ServiceStack.Common.dll and it's on the pwd. :(
Comment 4 Pablo Ruiz García 2012-11-21 10:41:24 UTC
Also, please note that ServiceStack.Common.dll targets net 3.5, while I'm compiling the test case with dmcs (thus targeting net 4).

When compiling with gmcs everything works fine, it's just when using dmcs when things go mad..

Obviouslly this works perfectly fine on MS.NET land.. So I guess this has to do with mono's internal/automatic redirection of system assemblies on mixed framework/profile escenarios like this one.
Comment 5 Marek Safar 2012-11-21 10:53:32 UTC
I've made a fix for very similar issue recently, so that probably fixes this issue as well. Please re-test this with master mono
Comment 6 Pablo Ruiz García 2012-11-21 16:15:41 UTC
By inspecting commit history on github I guessed this could be the case.. However, after building from master and trying again.. no luck. It fails too. :(

Just to clarify things here, ServiceStack.Common.dll was not built with mono. It's taken from an official release, which I assume was built using MS.NET toolchain..
Comment 7 Marek Safar 2012-11-21 16:40:31 UTC
As I said I cannot reproduce it with master, you can run it with MONO_LOG_LEVEL=debug to check you are really using master version
Comment 8 Pablo Ruiz García 2012-11-21 19:44:38 UTC
You were right Marek.. My local git checkout wasn't up-to-date.. I've rebuild it and now it works fine. Now I feel a bit stupid.. ;)