-
Notifications
You must be signed in to change notification settings - Fork 45
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 in vs2022 #201
Comments
Could you upgrade to 2.15? There is an update to support more PDB (debug info) file formats. |
hi picrap, Thanks. I have tried upgrading to version 2.15.0, but the error message is the same. In addition, I have a new discovery that the solution has created many class library projects, each library project has already referenced MrAdvice, but only one of them has a compilation error. I tried to remove the reference of the error project to MrAdvice, and the compilation passed. However, I did not find any difference in this class library project. I also created a new class library project and copied the files from the previous project into the new project. The new project also compiled an error, I guess, may some code in this project have had an impact? I don't know where to start dealing with this issue. |
Could you build in verbose mode and give me more details about the error? |
hi picrap, Thanks. 5>MrAdvice 2.15+c60086a4a967e33b58ed9c2dd7854a934aa67d8c/.NET 6.0 weaved module 'MyPorjectName.ServicesNew, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' (targeting framework .NET 6.0) in 451ms |
Could disable advices injections and reenable them one by one until it breaks again? There may be a weaving error in a very specific context that we need to isolate. |
hi picrap, public List GetAllCacheKeys() |
What advices do you apply in this assembly? Is this at assembly level? Or type/method level? |
hi picrap, Create a new class library project, reference MrAdvice(2.15.0), create a class and method with the following line of code, compile it, and the issue is reproduced, public class TestService Then I removed the const keyword and the compilation was successful. I think it's because of const. This is code written by someone else, and I don't know what their intention is. Also, I would like to know why const affects the compilation process of MrAdvice. Additionally, I found that this error only occurs when the const keyword is used internally within a method, but declaring a const constant at the class level does not result in this error. Thank you very much. |
Nice! I’ll look at it. |
hi,
I have encountered a troublesome problem,I referenced MrAdvice through NuGet in the class library project, version 2.14.0. However, during compilation, I received the following error message:
Error MSB3073 command “dotnet "C:\Users\myusername\.nuget\packages\mradvice\2.14.0\build..\tools\net6.0/MrAdvice.Weaver.dll" AssemblyPath="obj\Debug\net6.0\myprojectname.dll" ReferencePath="@obj\Debug\net6.0\myprojectname.dll.MrAdvice.ReferencePath.txt" ReferenceCopyLocalPaths="@obj\Debug\net6.0\myprojectname.dll.MrAdvice.LocalReferencePath.txt" AssemblyOriginatorKeyFile="" SignAssembly="false"” exited,code is 2。 myprojectname C:\Users\myusername\.nuget\packages\mradvice\2.14.0\build\MrAdvice.targets 16
I deleted the MrAdvice. targets file in path "C:\Users\myusername\.nuget\packages\mradvice\2.14.0\build" and compiled it successfully. However, when running the code, it directly ran the business method and did not enter the Advise method.
[AttributeUsage(validOn: AttributeTargets.Method, AllowMultiple = true)]
public class MyProudAdvice : Attribute, IMethodAsyncAdvice
{
public async Task Advise(MethodAsyncAdviceContext context)
{
// do things you want here
context.Proceed(); // this calls the original method
// do other things here
}
}
[MyProudAdvice]
public void MyProudMethod()
{
}
I see a similar problem here,#140
but my project is not a framework, I am using VS2022 and .NET6, I'm not sure if there is need for additional configuration.
Is there any solution? Thank you.
The text was updated successfully, but these errors were encountered: