Bug 293 - Error CS0266: Cannot implicitly convert type
Summary: Error CS0266: Cannot implicitly convert type
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Linux
: --- major
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2011-08-14 07:12 UTC by umbr0no
Modified: 2011-08-17 15:55 UTC (History)
1 user (show)

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


Attachments
Example (69.10 KB, application/zip)
2011-08-14 07:12 UTC, umbr0no
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 umbr0no 2011-08-14 07:12:06 UTC
Created attachment 125 [details]
Example

Hello,

I try to compile Umbraco 5 with the latest mono 2.11. 

I Checked out mono from git master to pass the MVC compiler error described here : https://bugzilla.novell.com/show_bug.cgi?id=673604

I isolated a first problem, steps to reproduce :

Create mono 2.11 project, reference Autofac 2.4.4.705 (included in attachment)
        

public void Test<T>()	{

var builder = new ContainerBuilder(); 

IRegistrationBuilder<T, ConcreteReflectionActivatorData, SingleRegistrationStyle> x1 = builder.RegisterType<T>();

IRegistrationBuilder<T, IConcreteActivatorData, SingleRegistrationStyle> x2 = builder.RegisterType<T>();

}

This will throw an exception like

/home/mono/Projects/Problem/Problem/Main.cs(103,103): Error CS0266: Cannot implicitly convert type `Autofac.Builder.IRegistrationBuilder<T,Autofac.Builder.ConcreteReflectionActivatorData,Autofac.Builder.SingleRegistrationStyle>' to `Autofac.Builder.IRegistrationBuilder<T,Autofac.Builder.IConcreteActivatorData,Autofac.Builder.SingleRegistrationStyle>'. An explicit conversion exists (are you missing a cast?) (CS0266) (Problem)

On MS .NET 4 this compiles without a problem.
Comment 1 Marek Safar 2011-08-17 04:52:49 UTC
Fixed in master
Comment 2 umbr0no 2011-08-17 12:23:40 UTC
Cool ! I am going to test it
Comment 3 umbr0no 2011-08-17 15:55:19 UTC
worked great!

thank you