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

[2.8.2][macOS] error AI_FAIL: Aspect Injector processing has failed #220

Open
Alex-Dobrynin opened this issue Jul 12, 2023 · 27 comments
Open
Labels

Comments

@Alex-Dobrynin
Copy link

Alex-Dobrynin commented Jul 12, 2023

After update to 2.8.2 from version 2.8.1 cannot build my netstandard2.1 lib, getting error mentioned in title. In macOS
image

@pamidur
Copy link
Owner

pamidur commented Jul 12, 2023 via email

pamidur added a commit that referenced this issue Jul 14, 2023
@pamidur
Copy link
Owner

pamidur commented Jul 14, 2023

please let me know if 2.8.3-pre1 fixes it for you!

@Alex-Dobrynin
Copy link
Author

the same

@kerojiang
Copy link

I got the same error on windows
This is build log
2> AspectInjector|2.8.2: Found 0 aspects, 6 injections
2>AspectInjector|2.8.2 : error AI_ERR0: Processing failure: System.ArgumentException: Arg_ArgumentException
2> at Mono.Cecil.Pdb.ISymUnmanagedWriter2.OpenScope(Int32 startOffset, Int32& pRetVal)
2> at Mono.Cecil.Pdb.NativePdbWriter.DefineScope(ScopeDebugInformation scope, MethodDebugInformation info, MetadataToken& import_parent)
2> at Mono.Cecil.Pdb.NativePdbWriter.DefineScope(ScopeDebugInformation scope, MethodDebugInformation info, MetadataToken& import_parent)
2> at Mono.Cecil.Pdb.NativePdbWriter.Write(MethodDebugInformation info)
2> at Mono.Cecil.Cil.CodeWriter.WriteResolvedMethodBody(MethodDefinition method)
2> at Mono.Cecil.Cil.CodeWriter.WriteMethodBody(MethodDefinition method)
2> at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method)
2> at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type)
2> at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)
2> at Mono.Cecil.MetadataBuilder.AddTypes()
2> at Mono.Cecil.MetadataBuilder.BuildTypes()
2> at Mono.Cecil.MetadataBuilder.BuildModule()
2> at Mono.Cecil.MetadataBuilder.BuildMetadata()
2> at Mono.Cecil.ModuleWriter.<>c.b__2_0(MetadataBuilder builder, MetadataReader _)
2> at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func3 read) 2> at Mono.Cecil.ModuleWriter.BuildMetadata(ModuleDefinition module, MetadataBuilder metadata) 2> at Mono.Cecil.ModuleWriter.Write(ModuleDefinition module, Disposable1 stream, WriterParameters parameters)
2> at Mono.Cecil.ModuleWriter.WriteModule(ModuleDefinition module, Disposable1 stream, WriterParameters parameters) 2> at Mono.Cecil.ModuleDefinition.Write(Stream stream, WriterParameters parameters) 2> at Mono.Cecil.ModuleDefinition.Write(WriterParameters parameters) 2> at Mono.Cecil.AssemblyDefinition.Write(WriterParameters parameters) 2> at FluentIL.PatcherBase.WriteAssembly(AssemblyDefinition assembly, Boolean writeSymbols, Boolean verbose) 2> at FluentIL.PatcherBase.Process(String assemblyFile, IAssemblyResolver resolver, Boolean optimize, Boolean verbose) 2> at FluentIL.PatcherBase.Process(String assemblyFile, IReadOnlyList1 references, Boolean optimize, Boolean verbose)
2> at AspectInjector.Compiler.Execute(String filename, IReadOnlyList`1 references, Boolean optimize, Boolean verbose). Please submit an issue to https://github.com/pamidur/aspect-injector
2>AspectInjector : error AI_FAIL: Aspect Injector processing has failed. See other errors.

@real-zony
Copy link

real-zony commented Aug 22, 2023

The macOS 13.4 also had the same issue. The version of AspectInjector is 2.8.2. It works normally in the Docker container of X64. My MacBook is M2 Max and uses the ARM version of dotnet (6.0.413).

@real-zony
Copy link

real-zony commented Aug 22, 2023

My temporary solution is to use Docker (x86) debugging in Rider (through Rosetta 2), but this makes the debugging very slow each time. Is there any update on this issue? Thank you.
I tried version 2.8.3-pre1 but it still did not solve my issue.😔

@pamidur
Copy link
Owner

pamidur commented Aug 23, 2023 via email

@real-zony
Copy link

Could you please use 2.8.1 while I'm fixing this? Just to double check, 2.8.2 does not work for x86 and arm and 2.8.1 does not work only for arm Correct?

On Wed, 23 Aug 2023, 03:02 Zony, @.> wrote: My temporary solution is to use Docker (x86) debugging in Rider (through Rosetta 2), but this makes the debugging very slow each time. Is there any update on this issue? Thank you. — Reply to this email directly, view it on GitHub <#220 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7HZUBT43MBTDOWQKARI73XWTCW7ANCNFSM6AAAAAA2IAYFTY . You are receiving this because you commented.Message ID: @.>

Of course, I rolled back to version 2.8.1, and it is working correctly.

@dartasen
Copy link

Same issue

@pamidur
Copy link
Owner

pamidur commented Aug 24, 2023

@real-zony , @dartasen, @Alex-Dobrynin ,
Unfortunatelly I don't have arm based mac machine to test it , so I have to rely on you.
Could you please confirm that 2.8.1 works fine on arm machine ?

@Alex-Dobrynin
Copy link
Author

Yes, 2.8.1 it works on mac m1

@pamidur
Copy link
Owner

pamidur commented Aug 25, 2023

Hey guys, could you please try 2.8.3-pre2 ?

@dartasen
Copy link

Hey guys, could you please try 2.8.3-pre2 ?

Same issue, unable to build
image

@pamidur
Copy link
Owner

pamidur commented Aug 29, 2023

do you use Rosetta ?

@serfend
Copy link

serfend commented Sep 11, 2023

when your method return is not void,you should only use Kind.Around

		[Advice(Kind.Around, Targets = Target.Method)]
		public object OnEnter([Argument(Source.Name)] string name,
			[Argument(Source.Arguments)] object[] args,
			[Argument(Source.Type)] Type hostType,
			[Argument(Source.Target)] Func<object[], object> target,
			[Argument(Source.Triggers)] System.Attribute[] triggers)
		{
			var mutex = new Mutex(false, Name);
			mutex.WaitOne();
			var result = target(args);
			mutex.ReleaseMutex();
			return result;
		}

@serfend
Copy link

serfend commented Sep 11, 2023

but while user use MVC , such error followed wont be shown.

AI_EA00	Advice 'OnEnter' must return 'object' for 'Around' advice	Test.Aspect-Injector.Failed	D:\backup\0.Main\workspace\resources\Test.Aspect-Injector.Failed\Test.Aspect-Injector.Failed\Test.Aspect-Injector.Failed\MutexHandlerAttribute.cs	43	活动

thats unexpected.

@serfend
Copy link

serfend commented Sep 11, 2023

you can refer to demo for a success running.

@serfend
Copy link

serfend commented Sep 11, 2023

amazing , i move exactly same code into other project , same error occurred.
windows11/vs2022 17.4.4.

AI_FAIL	Aspect Injector processing has failed. See other errors.	ProjectCommon	
..\Common\AspectInjector	1	

@serfend
Copy link

serfend commented Sep 11, 2023

i think i found where problem is,see docs

@stilettk
Copy link

stilettk commented Oct 6, 2023

I'm experiencing the same issue. I'm on Apple Silicon, my coworker with Mac on Intel doesn't have this problem.

Here is the detailed log:

     2>Target "_ASI_InjectAspectsCore" in file "/Users/stilettk/.nuget/packages/aspectinjector/2.8.3-pre2/buildTransitive/netstandard2.0/AspectInjector.targets" from project "/Users/stilettk/RiderProjects/loyalty/tests/Dodo.Loyalty.ComponentTests/Dodo.Loyalty.ComponentTests.csproj" (target "InjectAspects" depends on it):
       Set Property: _ProcessCmd="/Users/stilettk/.nuget/packages/aspectinjector/2.8.3-pre2/buildTransitive/netstandard2.0/../../build/_bin/osx-arm64/AspectInjector" -rf "/Users/stilettk/RiderProjects/loyalty/tests/Dodo.Loyalty.ComponentTests/obj/Debug/net7.0/Dodo.Loyalty.ComponentTests.dll._asi_refs" "/Users/stilettk/RiderProjects/loyalty/tests/Dodo.Loyalty.ComponentTests/obj/Debug/net7.0/Dodo.Loyalty.ComponentTests.dll"
       Task "Message" skipped, due to false condition; ( '$(AspectInjector_Debug)' == 'true' ) was evaluated as ( 'false' == 'true' ).
       Using "Exec" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
       Task "Exec"
         Task Parameter:Command="/Users/stilettk/.nuget/packages/aspectinjector/2.8.3-pre2/buildTransitive/netstandard2.0/../../build/_bin/osx-arm64/AspectInjector" -rf "/Users/stilettk/RiderProjects/loyalty/tests/Dodo.Loyalty.ComponentTests/obj/Debug/net7.0/Dodo.Loyalty.ComponentTests.dll._asi_refs" "/Users/stilettk/RiderProjects/loyalty/tests/Dodo.Loyalty.ComponentTests/obj/Debug/net7.0/Dodo.Loyalty.ComponentTests.dll"
         Task Parameter:EchoOff=True
         Task Parameter:IgnoreExitCode=True
         Task Parameter:WorkingDirectory=/Users/stilettk/.nuget/packages/aspectinjector/2.8.3-pre2/buildTransitive/netstandard2.0/
         /var/folders/y5/bg13rk8164n771x2jq7892ph0000gn/T/MSBuildTempstilettk/tmpaa7b21c171eb4634b4ae0d25bde46562.exec.cmd: line 2: 29017 Killed: 9               "/Users/stilettk/.nuget/packages/aspectinjector/2.8.3-pre2/buildTransitive/netstandard2.0/../../build/_bin/osx-arm64/AspectInjector" -rf "/Users/stilettk/RiderProjects/loyalty/tests/Dodo.Loyalty.ComponentTests/obj/Debug/net7.0/Dodo.Loyalty.ComponentTests.dll._asi_refs" "/Users/stilettk/RiderProjects/loyalty/tests/Dodo.Loyalty.ComponentTests/obj/Debug/net7.0/Dodo.Loyalty.ComponentTests.dll"
         Output Property: _AspectExitCode=137
       Done executing task "Exec".
       Using "Error" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
       Task "Error"
         Task Parameter:File=AspectInjector
         Task Parameter:Text=Aspect Injector processing has failed. See other errors.
         Task Parameter:Code=AI_FAIL
     2>AspectInjector : error AI_FAIL: Aspect Injector processing has failed. See other errors. [/Users/stilettk/RiderProjects/loyalty/tests/Dodo.Loyalty.ComponentTests/Dodo.Loyalty.ComponentTests.csproj]
       Done executing task "Error" -- FAILED.
     2>Done building target "_ASI_InjectAspectsCore" in project "Dodo.Loyalty.ComponentTests.csproj" -- FAILED.

@pamidur
Copy link
Owner

pamidur commented Oct 6, 2023

I'm really sorry my Mac users, since I don't have it is hard to figure out what actually goes wrong.
@stilettk do you have Rosetta installed?

@stilettk
Copy link

stilettk commented Oct 6, 2023

@stilettk do you have Rosetta installed?

I didn't explicitly install it, but according to this, I have it installed.

pamidur added a commit that referenced this issue Oct 6, 2023
@stilettk
Copy link

stilettk commented Oct 6, 2023

@pamidur FYI in 2.8.3-pre3 the problem persists

Build log
     2>Target "_ASI_InjectAspectsCore" in file "/Users/stilettk/.nuget/packages/aspectinjector/2.8.3-pre3/buildTransitive/netstandard2.0/AspectInjector.targets" from project "/Users/stilettk/RiderProjects/loyalty/tests/Dodo.Loyalty.ComponentTests/Dodo.Loyalty.ComponentTests.csproj" (target "InjectAspects" depends on it):
       Set Property: _ProcessCmd="/Users/stilettk/.nuget/packages/aspectinjector/2.8.3-pre3/buildTransitive/netstandard2.0/../../build/_bin/osx-arm64/AspectInjector" -rf "/Users/stilettk/RiderProjects/loyalty/tests/Dodo.Loyalty.ComponentTests/obj/Debug/net7.0/Dodo.Loyalty.ComponentTests.dll._asi_refs" "/Users/stilettk/RiderProjects/loyalty/tests/Dodo.Loyalty.ComponentTests/obj/Debug/net7.0/Dodo.Loyalty.ComponentTests.dll"
       Task "Message" skipped, due to false condition; ( '$(AspectInjector_Debug)' == 'true' ) was evaluated as ( 'false' == 'true' ).
       Using "Exec" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
       Task "Exec"
         Task Parameter:WorkingDirectory=/Users/stilettk/.nuget/packages/aspectinjector/2.8.3-pre3/buildTransitive/netstandard2.0/
         Task Parameter:Command="/Users/stilettk/.nuget/packages/aspectinjector/2.8.3-pre3/buildTransitive/netstandard2.0/../../build/_bin/osx-arm64/AspectInjector" -rf "/Users/stilettk/RiderProjects/loyalty/tests/Dodo.Loyalty.ComponentTests/obj/Debug/net7.0/Dodo.Loyalty.ComponentTests.dll._asi_refs" "/Users/stilettk/RiderProjects/loyalty/tests/Dodo.Loyalty.ComponentTests/obj/Debug/net7.0/Dodo.Loyalty.ComponentTests.dll"
         Task Parameter:IgnoreExitCode=True
         Task Parameter:EchoOff=True
         /var/folders/y5/bg13rk8164n771x2jq7892ph0000gn/T/MSBuildTempstilettk/tmp3c20c11a47674faaaeb388be23585be7.exec.cmd: line 2: 35405 Killed: 9               "/Users/stilettk/.nuget/packages/aspectinjector/2.8.3-pre3/buildTransitive/netstandard2.0/../../build/_bin/osx-arm64/AspectInjector" -rf "/Users/stilettk/RiderProjects/loyalty/tests/Dodo.Loyalty.ComponentTests/obj/Debug/net7.0/Dodo.Loyalty.ComponentTests.dll._asi_refs" "/Users/stilettk/RiderProjects/loyalty/tests/Dodo.Loyalty.ComponentTests/obj/Debug/net7.0/Dodo.Loyalty.ComponentTests.dll"
         Output Property: _AspectExitCode=137
       Done executing task "Exec".
       Using "Error" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
       Task "Error"
         Task Parameter:File=AspectInjector
         Task Parameter:Code=AI_FAIL
         Task Parameter:Text=Aspect Injector processing has failed. See other errors.
     2>AspectInjector : error AI_FAIL: Aspect Injector processing has failed. See other errors. [/Users/stilettk/RiderProjects/loyalty/tests/Dodo.Loyalty.ComponentTests/Dodo.Loyalty.ComponentTests.csproj]
       Done executing task "Error" -- FAILED.
     2>Done building target "_ASI_InjectAspectsCore" in project "Dodo.Loyalty.ComponentTests.csproj" -- FAILED.

@pamidur
Copy link
Owner

pamidur commented Oct 6, 2023

can you try https://www.nuget.org/packages/AspectInjector/2.8.3-pre3#supportedframeworks-body-tab ? and see if it helps
if it still does not work, you can try adding

<PropertyGroup>
    <AspectInjector_UseRosetta>true</AspectInjector_UseRosetta>
  </PropertyGroup>

to your csproj

@stilettk
Copy link

stilettk commented Oct 6, 2023

What do you mean by trying https://www.nuget.org/packages/AspectInjector/2.8.3-pre3#supportedframeworks-body-tab? To use net20 or netstandard2.0? Unfortunately, I can't do this in my project because all references require newer versions.

AspectInjector_UseRosetta helped though. But I hope that this won't be a requirement because AspectInjector is a transitive dependency for us (from Allure.NUnit).

@pamidur
Copy link
Owner

pamidur commented Oct 6, 2023

it is there just to test it. It seems like Rosetta is going to be a requirement and after the next release it is going to be the only supported option. I just can't make it run on apple silicon without rosetta without having actual mac :(

@gshuchi
Copy link

gshuchi commented May 16, 2024

Hey People! Install the terminal with Rosetta settings and this error will be gone after dotnet build command.

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

8 participants