Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NetStandard2.0 version #889

Closed
sescandell opened this issue Jan 11, 2018 · 7 comments
Closed

.NetStandard2.0 version #889

sescandell opened this issue Jan 11, 2018 · 7 comments

Comments

@sescandell
Copy link

Hi there,

Any change to get a release including .netstandard2.0 target ?

If I well understand latests commits and issues, things are made so .netstandard2.0 is now targeted.

I made a simple test project and for now, we cannot use Azure Function V2 with Autofac, I supposed because of .netstandard2 targeting issue (at runtime, process doesn't succeed to load the Autofac Assembly).

Thanks for your feedback,

@tillig
Copy link
Member

tillig commented Jan 11, 2018

Duplicate of #867.

netstandard 1.1 is 100% compatible with netstandard 2.0. The reverse is not true - you can't use netstandard 2.0 items in netstandard 1.1 projects. We need to maintain as wide a compatibility as possible, so we will continue targeting netstandard 1.1. If that isn't working in your netstandard 2.0 project, it's likely a tooling problem. I'd recommend asking the folks in the Azure Functions repo or on StackOverflow.

Note a quick Google search of "azure functions autofac" returns several things that may help you.

I'd recommend doing some searching to see if you can get unblocked before filing an issue with Azure Functions or asking on StackOverflow. It looks like the examples and answers you're looking for could be out there already.

@tillig tillig closed this as completed Jan 11, 2018
@MihaMarkic
Copy link

MihaMarkic commented Jan 19, 2018

@tillig While this is true, there is a drawback not having .NETStandard 2.0 target: it will drag a lot of references to a (i.e. Xamarin) project. Supporting .NETStandard 2.0 means just adding a target to TargetFrameworks node (netstandard2.0) and fixing a empty array allocation. The code will be still the same but it won't drag a ton of references.
Also @sescandell asked to add target, not to replace it.

I can provide a PR if you wish so.

@alexmg
Copy link
Member

alexmg commented Jan 21, 2018

The empty array return value could actually be Enumerable.Empty<IComponentRegistration>() which is the normal return value used when no match is found in a RegistrationsFor method. It explains why only that one compiler issue was found.

The general recommendation is "to target the lowest version of .NET Standard possible".

@MihaMarkic Can you expand on the issue you are seeing with the Xamarin project?

@sescandell Did you manage to find out what the cause of your Azure Functions V2 issue was?

If there are good reasons for adding an additional target then it is something we can consider. If the issue lies elsewhere then the problem will only be solved until another library targeting a lower version of .NET Standard is added to such projects triggering the same issue.

@MihaMarkic
Copy link

@alexmg Check references.

@sescandell
Copy link
Author

Hi,

I opened an issue on MSDN Forum.

This specific issue seems to be tied to Azure Function V2 in particular. As I said in my first post, everything is working fine on Azure Function V1. I'm not asking "how to make Autofac work with Azure Function". Something that worked with AFv1 doesn't work anymore with AFv2.

But, contrary to my first feelings and as @tillig precised, this is not an issue from Autofac neither because of a missing targeted framework. Azure Function v2 is working fine with Autofac v4.0.0.
Microsoft probably changed something on how libraries are loaded that break using a different version of Autofac than the one embedded by Azure Functions.

Thanks for your help!

@MihaMarkic
Copy link

By the way, I made a few tiny modifications to sources for targeting :NET Standard 2.0. Seems working just fine in a project of mine.

@MihaMarkic
Copy link

Just to end the debate. Latest VS NuGet pacakage manager will hide the mentioned references and thus won't pollute anymore.
IOW no need for support .NET Standard 2 anymore from this point of view.

alexmg added a commit that referenced this issue Sep 10, 2018
…endencyResolutionException serializable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants