Bug 37137 - ArgumentNullException is thrown when asmx webservice is requested
Summary: ArgumentNullException is thrown when asmx webservice is requested
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web.Services ()
Version: 4.2.0 (C6)
Hardware: All All
: --- normal
Target Milestone: Untriaged
Assignee: Aleksey Kliger
: 39772 ()
Depends on:
Reported: 2015-12-18 08:10 UTC by Ondrej Myska
Modified: 2016-04-04 15:54 UTC (History)
5 users (show)

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

Webservice project (4.05 KB, application/x-zip-compressed)
2015-12-18 08:10 UTC, Ondrej Myska

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:

Description Ondrej Myska 2015-12-18 08:10:39 UTC
Created attachment 14346 [details]
Webservice project

I have an issue with hosting of any asmx webservice with Mono 4.2.1 (both arm runtime and windows runtime). I've tried both Xsp and Nginx(FastCGI) hosting. When I try to access webservice url, exception is raised. Same problem is described here: http://stackoverflow.com/questions/33848638/system-argumentnullexception-in-mono-asp-net-web-service. Webservice works as expected on Mono 3.2.8 runtime.

Steps to Reproduce:
1) Create project with any amx webservice (for example use attached)
2) Build it
3) Deploy it with Xsp or Nginx (FastCGI)
4) Go to webservice url.

Actual Results:
The webservice crashed with following  exception:

Application Exception
Value cannot be null.
Parameter name: path1

Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): mscorlib.
Exception stack trace:
  at System.IO.Path.Combine (System.String path1, System.String path2) <0x74377238 + 0x001c0> in <filename unknown>:0 
  at System.Web.Services.Configuration.WsdlHelpGeneratorElement.get_HelpGeneratorPath () <0x7277c520 + 0x00027> in <filename unknown>:0 
  at System.Web.Services.Protocols.DocumentationServerProtocol.Initialize () <0x727d9ba0 + 0x0056b> in <filename unknown>:0 
  at System.Web.Services.Protocols.ServerProtocol.SetContext (System.Type type, System.Web.HttpContext context, System.Web.HttpRequest request, System.Web.HttpResponse response) <0x727d7f00 + 0x00087> in <filename unknown>:0 
  at System.Web.Services.Protocols.ServerProtocolFactory.Create (System.Type type, System.Web.HttpContext context, System.Web.HttpRequest request, System.Web.HttpResponse response, System.Boolean& abortProcessing) <0x727d7a48 + 0x000ab> in <filename unknown>:0 

Expected Results:
Web page with webservice overview is shown.

Build Date & Hardware:
Mono JIT compiler version 4.2.1 (Stable Thu Nov 12 10:06:49 UTC 2015)
		TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp+hard
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen

Additional Builds and Platforms:
Occurs with Mono 4.2.1 Arm runtime, Mono 4.2.1 Windows runtime. Both hosten in Xsp and then in Nginx(FastCGI).
Mono 3.2.8 is not affected and webservice works as expected (hosted in Xsp).

Additional Information:
Project with webservice is attached.
Comment 1 david lawrence 2016-01-13 15:26:36 UTC
Is anyone looking at this?

This is a bug I have encountered as well.. 

This is the mono version I encountered it with

Mono JIT compiler version 4.2.2 (Stable Wed Jan 13 13:26:09 UTC 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen

Did not experience issue with

Mono JIT compiler version 3.12.1 (tarball Mon Jan 11 13:09:06 UTC 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen
Comment 2 Ondrej Myska 2016-01-14 07:53:47 UTC
@david lawrence

I looked at it about before two weeks ago. I investigated exception stack trace and I tried to find getter HelpGeneratorPath in class WsdlHelpGeneratorElement in, but with no luck. After that, I search more deeply and I detect the commit https://github.com/mono/mono/commit/f4f5864fdeffc2e5d8c3a71f38af30fac8f8a0d7 that removed mono implementation of WsdlHelpGeneratorElement class and replace it with WsdlHelpGeneratorElement from referencesource.
I think this commit is root of issue.
Comment 3 david lawrence 2016-01-14 11:15:27 UTC
I'm surprised me that there has been no response to this.. It would seem to be a rather fundamental issue. All asmx services are rendered dead with this bug. It could hardly be described as corner case. 

Anyone at Xamarin in a position to even offer a possible workaround?
Comment 4 david lawrence 2016-01-14 12:54:33 UTC
Found workaround


        <remove name="Documentation" />

in Web.config

You still won't be able to view wsdl/help page because it will no longer process GET requests however the service will now be usable for existing clients who already created their client proxies.
Comment 5 Timotheus Pokorra 2016-01-15 21:24:22 UTC
I had this problem already in November on Linux, but somehow did not report it upstream (https://github.com/openpetra/openpetra/issues/110).

the code is here: HelpGeneratorPath

this.actualPath is null

MONO_BROKEN_CONFIGURATION_DLL is set in https://github.com/mono/mono/blob/mono-

a workaround was this patch, but it is bad because it has a hardcoded path and would not work anywhere else:
Comment 6 Timotheus Pokorra 2016-01-19 09:15:37 UTC
I noticed that GetConfigurationDirectory() returns the required path, which avoids the hard coded path.

I have submitted a pull request:
Comment 7 Timotheus Pokorra 2016-02-09 08:40:12 UTC
my first pull request was rejected, but this pull request solved the problem properly: https://github.com/mono/referencesource/pull/22

I think this bug can be closed, but I seem not to have permissions to change the status of this bug.
Comment 8 Aleksey Kliger 2016-02-09 16:08:58 UTC
Fixed merged in referencesource 78dccece97d38f6e771ce039001c84fa8435349a.  Mono master 7ecd89abdbacd5c7ace69f63ca73a6bee6a10ca6

Thanks Timotheus!
Comment 10 Aleksey Kliger 2016-03-22 18:55:24 UTC

I think you mean https://github.com/mono/referencesource/commit/054efb814f0498927d8046fc015a4926968d51b1

(Pretty sure what AppContextDefaults don't have much to do with asmx help pages).
Comment 11 Timotheus Pokorra 2016-03-22 19:15:52 UTC
ah, that makes sense!

I refered to the commit that you posted in https://bugzilla.xamarin.com/show_bug.cgi?id=37137#c8 and thought it might have been related although I did not understand the relation.
Comment 12 Aleksey Kliger 2016-03-22 19:23:46 UTC
Oh. Darn, you're right: No idea what I was thinking in comment 8. I'll cherry pick the correct commit.
Comment 13 Aleksey Kliger 2016-03-23 14:59:22 UTC
Okay, let me try to get this right:

fixed in referencesource 4.4 branch with commit https://github.com/mono/referencesource/commit/3ea604b68a4ef4774b7538f66430c0a0c437033c
the submodule was updated on mono 4.4 branch with commit
Comment 14 Andi McClure 2016-04-04 15:54:48 UTC
*** Bug 39772 has been marked as a duplicate of this bug. ***