Bug 8334 - rx: InternalsVisibleTo incorrectly resolves to private methods
Summary: rx: InternalsVisibleTo incorrectly resolves to private methods
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2012-11-12 05:27 UTC by Atsushi Eno
Modified: 2012-11-14 05:48 UTC (History)
1 user (show)

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

repro patch set to mono tree (with external/rx) (9.16 KB, application/x-bzip)
2012-11-12 05:27 UTC, Atsushi Eno
missing reactive.pub (160 bytes, application/octet-stream)
2012-11-12 14:41 UTC, Atsushi Eno

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 Atsushi Eno 2012-11-12 05:27:06 UTC
Created attachment 2903 [details]
repro patch set to mono tree (with external/rx)

This is (sorry to say again) non-unit test case that was found during import of rx.codeplex.com into mono.

It seems that mcs fails to resolve method invocations to the _private_ one (which is wrong) in the nearest ancestor, instead of the expected _internal_ further ancestors.


Almost the same as bug #8320, but with the updated patch attached here this time. You could remove mcs/class/*Reactive* and [checkout mcs/class/Makefile and re-apply add-rx-libs.patch] or [edit mcs/class/Makefile and add System.Reactive.Debugger]. This patch updates involves some Makefile changes, additional sources and additional build args, so you most likely want to remove old directories.

Then run "make run-test"

(Actually I tried to create simpler repro but I couldn't.)

Actual Results:

Failures like this:

67) ReactiveTests.Tests.RegressionTest.Bug_1297_Catch_Single : System.MethodAccessException : Method `System.Reactive.TailRecursiveSink`1<int>:Dispose ()' is inaccessible from method `System.Reactive.Linq.Observαble.Catch`1/_<int>:Done ()'

at System.Reactive.TailRecursiveSink`1[System.Int32].MoveNext () [0x0019c] in /svn/mono/external/rx/Rx.NET/System.Reactive.Linq/Reactive/Internal/TailRecursiveSink.cs:137
at System.Reactive.Concurrency.AsyncLock.Wait (System.Action action) [0x000b6] in /svn/mono/external/rx/Rx.NET/System.Reactive.Core/Reactive/Concurrency/AsyncLock.cs:57

Expected Results:

none of the errors above.

Additional Notes:

The updated patch set contains an additional patch to "System.Reactive.Linq" in rx tree. In the updated patch archive, there is "internals-visibleto-workaround.patch". It actually describes the bug. With this patch, those problematic NUnit failures are gone. The patch changes the call target to the appropriate base class that contains the exact target internal method to resolve.
Comment 1 Atsushi Eno 2012-11-12 14:16:18 UTC
I set up shrunk source tree of MS rx at https://github.com/atsushieno/rx.

If you checkout "rx-oss-v1.0" branch, it is already applied the patches inside Rx.NET tree.
Comment 2 Atsushi Eno 2012-11-12 14:41:52 UTC
Created attachment 2908 [details]
missing reactive.pub

I forgot to attach a public key for rx assemblies that is now referenced by each "MonoAssemblyInfo.cs" file.
Comment 3 Marek Safar 2012-11-14 05:48:17 UTC
Fixed in master