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

A strongly-named assembly is required. #207

Closed
chessar opened this issue Sep 3, 2018 · 14 comments · Fixed by #281
Closed

A strongly-named assembly is required. #207

chessar opened this issue Sep 3, 2018 · 14 comments · Fixed by #281

Comments

@chessar
Copy link

chessar commented Sep 3, 2018

Could not load file or assembly 'Auth0.Core, Version=5.10.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044).

Please sign with strong name key Auth0.AuthenticationApi, Auth0.ManagamentApi, Auth0.Core and Auth0.AspNet

@robertmclaws
Copy link
Contributor

Strong-naming NuGet packages is no longer recommended. If you need a strong-named package chain, please consider using https://www.nuget.org/packages/strongnamer instead.

@chessar
Copy link
Author

chessar commented Sep 3, 2018

If you need a strong-named package chain, please consider using https://www.nuget.org/packages/strongnamer instead.

When using this NuGet package (strongnamer), the specified error occurs when you try to call AuthenticationApiClient.GetTokenAsync.

If you do not use this package, the error occurs earlier (when you start the application)

@robertmclaws
Copy link
Contributor

Did you follow the directions here: https://github.com/dsplaisted/strongnamer

@chessar
Copy link
Author

chessar commented Sep 4, 2018

Did you follow the directions here: https://github.com/dsplaisted/strongnamer

Yes, I followed the directions.

All three assemblies (Auth0.AuthenticationApi, Auth0.ManagamentApi, Auth0.Core) that I use in my application are signed during the build. But getting the result after GetTokenAsync, at the moment of deserializing the response, the specified error occurs.

@robertmclaws
Copy link
Contributor

What "specified" error, the "cannot load" error?

@chessar
Copy link
Author

chessar commented Sep 4, 2018

What "specified" error, the "cannot load" error?

Yes, Could not load file or assembly 'Auth0.Core, ....

@robertmclaws
Copy link
Contributor

Are you positive that assembly is signed? Are you also positive that the error isn't something else and you're just not reading it clearly? Would be helpful if you posted both the unsigned and the signed error messages in their entirety, including stack traces.

@chessar
Copy link
Author

chessar commented Sep 4, 2018

Assemblies Auth0. *.dll in the bin folder of my application is signed. In the near future, I'm trying to create a minimal application that reproduces, and also attach stacktrace

@chessar
Copy link
Author

chessar commented Sep 5, 2018

Exception Stack trace

System.IO.FileLoadException
Could not load file or assembly 'Auth0.Core, Version=5.10.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
	at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
	at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
	at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
	at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimePropertyInfo property, RuntimeType caType)
	at System.Attribute.InternalGetCustomAttributes(PropertyInfo element, Type type, Boolean inherit)
	at Newtonsoft.Json.Utilities.ReflectionUtils.GetAttributes[T](Object attributeProvider, Boolean inherit)
	at Newtonsoft.Json.Utilities.ReflectionUtils.GetAttribute[T](Object attributeProvider, Boolean inherit)
	at Newtonsoft.Json.Serialization.JsonTypeReflector.GetAttribute[T](MemberInfo memberInfo)
	at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
	at Newtonsoft.Json.Serialization.JsonTypeReflector.GetJsonConverter(Object attributeProvider)
	at Newtonsoft.Json.Serialization.DefaultContractResolver.SetPropertySettingsFromAttributes(JsonProperty property, Object attributeProvider, String name, Type declaringType, MemberSerialization memberSerialization, Boolean& allowNonPublicAccess)
	at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
	at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateProperties(Type type, MemberSerialization memberSerialization)
	at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateObjectContract(Type objectType)
	at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract(Type objectType)
	at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
	at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract(Type type)
	at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
	at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
	at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
	at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonConverter[] converters)
	at Auth0.Core.Http.ApiConnection.<RunAsync>d__20`1.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	at Auth0.Core.Http.ApiConnection.<GetAsync>d__15`1.MoveNext()

@robertmclaws
Copy link
Contributor

So it looks like internal assembly references by not have been re-written (look at the reference string, it doesn't have a PublicKeyToken in it.

Try this one instead: https://www.nuget.org/packages/Brutal.Dev.StrongNameSigner/ This NuGet package is in active development, and any signing issues you can work through with them.

@chessar
Copy link
Author

chessar commented Sep 7, 2018

Hello @robertmclaws,

I tried package Brutal.Dev.StrongNameSigner. He did not help - the same error.

@dlemstra
Copy link
Contributor

dlemstra commented Aug 6, 2019

It is now again recommended to make create strong named open-source libraries:

I can create a PR for this if you would want some help with this.

@dlemstra
Copy link
Contributor

Could you take a look at this @luisrudge?

@luisrudge
Copy link
Contributor

@dlemstra we'll have to wait @damieng on this one. He's on vacation this week and will take a look on this next week.

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

Successfully merging a pull request may close this issue.

4 participants