Comments (9)
Could you upgrade to 2.15? There is an update to support more PDB (debug info) file formats.
from mradvice.
hi picrap,
Thanks.
The current solution compilation does not pass. How can I view valid information from the PDB, because there is an error in compilation and the project cannot be started.
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.
from mradvice.
Could you build in verbose mode and give me more details about the error?
from mradvice.
hi picrap,
Thanks.
I have found the following information and I am not sure if it is helpful for troubleshooting,
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
5>Unhandled exception: dnlib.DotNet.Writer.ModuleWriterException: Expected a null constant. Error occurred after metadata event BeginWriteMethodBodies.
5> at dnlib.DotNet.DummyLogger.Log(Object sender, LoggerEvent loggerEvent, String format, Object[] args)
5> at dnlib.DotNet.Writer.ModuleWriterBase.dnlib.DotNet.ILogger.Log(Object sender, LoggerEvent loggerEvent, String format, Object[] args)
5> at dnlib.DotNet.Writer.Metadata.Error(String message, Object[] args)
5> at dnlib.DotNet.Writer.Metadata.dnlib.DotNet.Writer.IWriterError.Error(String message)
5> at dnlib.DotNet.Pdb.Portable.LocalConstantSigBlobWriter.Write(DataWriter writer, TypeSig type, Object value)
5> at dnlib.DotNet.Pdb.Portable.LocalConstantSigBlobWriter.Write(IWriterError helper, Metadata systemMetadata, DataWriter writer, TypeSig type, Object value)
5> at dnlib.DotNet.Writer.Metadata.AddLocalConstant(PdbConstant constant)
5> at dnlib.DotNet.Writer.Metadata.WriteMethodBodies()
5> at dnlib.DotNet.Writer.Metadata.Create()
5> at dnlib.DotNet.Writer.Metadata.CreateTables()
5> at dnlib.DotNet.Writer.ModuleWriter.WriteImpl()
5> at dnlib.DotNet.Writer.ModuleWriterBase.Write(Stream dest)
5> at dnlib.DotNet.Writer.ModuleWriterBase.Write(String fileName)
5> at dnlib.DotNet.ModuleDef.Write(String filename, ModuleWriterOptions options)
5> at StitcherBoy.Reflection.ModuleManager.WriteModule(ModuleWriterOptionsBase moduleWriterOptionsBase)
5> at StitcherBoy.Reflection.ModuleManager.Write(String assemblyOriginatorKeyFile)
5> at StitcherBoy.Weaving.Build.AssemblyStitcher.Process(IDictionary`2 parameters, String entryAssemblyPath)
5> at StitcherBoy.Stitcher.Run[TStitcher](String[] args)
from mradvice.
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.
from mradvice.
hi picrap,
Thanks,
I think this is a great suggestion. I have located the code below and commented it out, then it can be compiled successfully. However, I don't understand why they have an impact. Also, do I need to implement the commented part of the code in a different way?
public List GetAllCacheKeys()
{
//const BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic;
//var coherentState = _memoryCache.GetType().GetField("_coherentState", flags);
//var entries = coherentState.GetType().GetField("_entries", flags).GetValue(coherentState);
//var cacheItems = entries as IDictionary;
var keys = new List();
//if (cacheItems == null) return keys;
//foreach (DictionaryEntry cacheItem in cacheItems)
//{
// keys.Add(cacheItem.Key.ToString());
//}
return keys;
}
from mradvice.
What advices do you apply in this assembly? Is this at assembly level? Or type/method level?
And in what chain is this code applied? In an advice or in some other code?
from mradvice.
hi picrap,
Thanks.
I followed the steps below to reproduce this compilation error,
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
{
public void Test()
{
const BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic;
}
}
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.
from mradvice.
Nice! I’ll look at it.
from mradvice.
Related Issues (20)
- Failed to resolve assembly: System.Private.CoreLib, Version=5.0.0.0 HOT 20
- Dotnet core DI and logging HOT 6
- Incorrect version in MrAdvice.dll HOT 11
- MrAdvice.Weaver.exe fails on Visual Studio 2017 HOT 2
- MrAdviceWeaverPath not defined in Xamarin.Android project HOT 8
- dotnet build on linux build agents
- Containerize the solution in linux with .NET Core 3.1 HOT 4
- Crash when weaving in azure linux build agent .net 6 HOT 4
- StackTraceHiddenAttribute
- Support for .NET 7 HOT 1
- NullReferenceException on build
- No compatible code running on the thread HOT 2
- .NET 8 support? HOT 3
- Cannot build project on mac HOT 7
- PDB fails to load HOT 7
- Advice on methods of child class HOT 1
- Error code 1 when project have refference to MrAdvice, but doesn't have any annotations HOT 3
- [feature request] Allow set custom attributes on inner method HOT 4
- Override assembly level attributes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mradvice.