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

Portable build warnings in a Metro style app #358

Closed
alexmg opened this issue Jan 22, 2014 · 8 comments
Closed

Portable build warnings in a Metro style app #358

alexmg opened this issue Jan 22, 2014 · 8 comments
Labels

Comments

@alexmg
Copy link
Member

alexmg commented Jan 22, 2014

From [email protected] on April 08, 2012 00:06:21

I downloaded http://code.google.com/p/autofac/downloads/detail?name=Autofac-2.6.1.841-Portable.zip and tried using it in a C# Metro style app.

The build resulted in 2 errors I don't know how to get rid off:

  1. Reference to type 'System.Reflection.BindingFlags' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETCore\v4.5\mscorlib.dll', but it could not be found
  2. The assembly "Autofac.dll" does not have a NeutralResourcesLanguageAttribute on it. To be used in an AppX package, portable libraries must define a NeutralResourcesLanguageAttribute on their main assembly (ie, the one containing code, not a satellite assembly).

I wanted to take a look at the source code and try to fix the issues, but couldn't find it while browsing the repository. Where is it committed to?

Are there any plans to make the portable build work with Metro style apps?

Original issue: http://code.google.com/p/autofac/issues/detail?id=358

@alexmg
Copy link
Member Author

alexmg commented Jan 22, 2014

From [email protected] on April 11, 2012 22:45:27

Thanks for the report. These warnings shouldn't prevent use of the library. We need to add the mentioned attribute (2) so that Autofac's exception message strings are packaged correctly into AppX.

Regarding the BindingFlags warning - are you using any of the methods/constructors that accept BindingFlags? It appears that BindingFlagsConstructorInvoker would be the type causing this. In this instance, I think we need to expose different constructor parameters (e.g. "bool usePrivate") as a substitute when running with Metro style apps, and remove the BindingFlags versions from Autofac's public portable API surface.

Status: Accepted

@alexmg
Copy link
Member Author

alexmg commented Jan 22, 2014

From [email protected] on April 14, 2012 03:34:41

You're right. In spite of the warnings (not errors as I've written above) I can use the library and it works. But I am a bit concerned about the store certification process, although the Windows App Certification Kit currently doesn't seem to complain about it.

I'm not using any method or constructors accepting BindingFlags, at least not that I'm aware of. These are the only APIs that I'm currently calling:
var builder = new ContainerBuilder();
builder.RegisterType().SingleInstance();
builder.RegisterType();
builder.RegisterType().As();
var container = builder.Build();
container.Resolve();

@alexmg
Copy link
Member Author

alexmg commented Jan 22, 2014

From travis.illig on May 14, 2012 11:26:56

It doesn't fix it for the current release... but I've added NeutralResourcesLanguageAttribute to every assembly in the 3.0 branch.

@alexmg
Copy link
Member Author

alexmg commented Jan 22, 2014

From [email protected] on June 17, 2012 18:59:41

Hi Travis / Nick,
We're using Autofac (2.6.1) with a new metro app for a client.
When autofac throws an error it tries to read the exception message from a resource and crashes with a MissingManifestResourceException (Unable to load resources for resource file). Is this related to this NeutralResourcesLanguage attribute missing, or would you like a separate issue to be raised?

If the fix is just the change to the attribute, would you please consider backporting this fix to 2.x while 3.0 is not yet ready for use?

@alexmg
Copy link
Member Author

alexmg commented Jan 22, 2014

From [email protected] on June 18, 2012 07:27:38

Thanks for the additional info. Not sure if this is related or not. We'll definitely get this running in the 2.x branch, 3.x is still some time off. Cheers!

@alexmg
Copy link
Member Author

alexmg commented Jan 22, 2014

From [email protected] on June 24, 2012 07:18:38

Hey Nick,
I'll raise a proper issue for the error that we're hitting with our metro app.

@alexmg
Copy link
Member Author

alexmg commented Jan 22, 2014

From [email protected] on September 14, 2012 02:03:47

The BindingFlags issue also breaks Code Analysis on the project.

2> Running Code Analysis...
2>MSBUILD : error : CA0055 : Could not load Project.exe. The following error was encountered while reading module 'Autofac': Could not resolve type reference: [mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]System.Reflection.BindingFlags.
2>MSBUILD : error : CA0052 : No targets were selected.

@alexmg
Copy link
Member Author

alexmg commented Jan 22, 2014

From travis.illig on September 20, 2012 09:17:39

The 3.0 branch has been moved to trunk and should be released soon. We have tested use on a simple Windows Store app and the BindingFlags warning is gone.

You may still see some SecAnnotate.exe or FxCop issues, but these are Portable Class Library problems, not something we can fix. See this StackOverflow question for an example: http://stackoverflow.com/questions/12360534/how-can-i-successfully-run-secannotate-exe-on-a-library-that-depends-on-a-portab I'm going to close this as fixed since it's set for the impending 3.0 release. Once you get 3.0, let us know if you find anything else and we'll hook you up.

Status: Fixed

@alexmg alexmg closed this as completed Jan 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant