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

Compilation error: Sequence contains no matching element #75

Closed
pberggreen opened this issue Sep 21, 2018 · 7 comments
Closed

Compilation error: Sequence contains no matching element #75

pberggreen opened this issue Sep 21, 2018 · 7 comments

Comments

@pberggreen
Copy link

After upgrading from version 1.0.0-beta4 to version 1.0.1 I get the compilation error below.
I have only one aspect with the following attribute:
[Advice(Advice.Type.Around, Advice.Target.Method)]

26>EXEC : error : System.InvalidOperationException: Sequence contains no matching element
26> at System.Linq.Enumerable.First[TSource](IEnumerable1 source, Func2 predicate)
26> at AspectInjector.Core.Models.Converters.MethodDefinitionConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
26> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
26> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
26> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
26> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
26> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
26> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
26> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
26> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
26> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
26> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
26> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
26> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
26> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
26> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
26> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
26> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
26> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
26> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
26> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
26> at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
26> at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
26> at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
26> at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
26> at AspectInjector.Core.Services.AssetsCache.ReadAssetsFromModule(ModuleDefinition module)
26> at AspectInjector.Core.Services.AssetsCache.EnsureCacheLoaded(ModuleDefinition module)
26> at AspectInjector.Core.Services.AssetsCache.GetAssets(ModuleDefinition module)
26> at AspectInjector.Core.Services.AssetsCache.ReadAspect(TypeDefinition type)
26> at AspectInjector.Core.Services.InjectionCollector.ParseInjectionAttribute(ICustomAttributeProvider target, CustomAttribute attr)
26> at AspectInjector.Core.Services.InjectionCollector.ExtractInjections(ICustomAttributeProvider target)
26> at AspectInjector.Core.Services.InjectionCollector.Collect(AssemblyDefinition assembly)
26> at AspectInjector.Core.Processor.ProcessAssembly(AssemblyDefinition assembly)
26> at AspectInjector.Core.Processor.Process(String assemblyFile, IAssemblyResolver resolver)
26> at AspectInjector.Commands.ProcessCommand.Execute(IReadOnlyList`1 args)
26>AspectInjector : error ASI0001: Aspect Injector processing has failed. See other errors.

@pamidur
Copy link
Owner

pamidur commented Sep 21, 2018

Hi, thanks for the report.

Honestly this json serialization/deserialization is quite bugy from the very beginning. We're thinking to get rid of it.
So this is a chance to ask -> are you ok to have runtime reference to AspectInjector.Broker.dll (netstandard1.0) and instead have everything much more stable?

As to your particular case -> try to recompile everything with 1.0.1 version (check other projects references and make rebuild all). If is doesn't help, please drop a project sample here, so we can reproduce the error.

Thanks

@pberggreen
Copy link
Author

I have tried rebuilding my solution with both version 1.0.1 and 1.5.2-beta and I still get that compilation error.

Frankly, I don't know the consequences of having a runtime ref to AspectInjector.Broker.dll (netstandard1.0), but more stability sounds nice :-)

@pamidur
Copy link
Owner

pamidur commented Sep 21, 2018

it is just an additional small dll :) no more than that

The issue might happen if you have a dll with aspects which is built using 1.0.*-beta. And then you try using those aspects in another project with 1.0.1 release

@pberggreen
Copy link
Author

Unfortunately, I cannot send you the whole solution and my smaller sample project compiles without problems.
Any suggestions?

@pamidur
Copy link
Owner

pamidur commented Sep 21, 2018

I could only suggest make CleanAll, manually remove all obj and bin folders. And try again.

We will be looking further into this issue.

@pberggreen
Copy link
Author

Unfortunately, Clean All and removing all obj and bin folders didn't help.
I'll look forward to a better solution.

@pamidur
Copy link
Owner

pamidur commented Dec 4, 2018

Should be fixed in https://github.com/pamidur/aspect-injector/releases/tag/2.0.0-beta1 . However beware there are braking changes, you'd need to modify you code code (slightly)

@pamidur pamidur closed this as completed Dec 4, 2018
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

2 participants