Comments (12)
Hi,
I'm aware of these two. I even had to ignore three errors in my peverify call, here is the batch part in Mr. Advice which checks the generated assemblies:
rem muted errors as follow (not sure muting them is good, but they are no valid errors)
rem 0x801318BF because an advised ctor can call the base class ctor
rem 0x80131859 warning of 'this' being uninitialized in ctor
rem 0x8013184F because .ctor inner (wrapped original) method calls base..ctor()
%peverify% /nologo /hresult /ignore=0x801318BF,0x80131859,0x8013184F %1
I'm open to suggestions if you know how to fix this anyway.
Pascal.
from mradvice.
I'll try to look into it.
The asp.net project that I'm trying to use MrAdvice in doesn't work. When I
try to access a page, the app pool crashes and I have to go into iis to
restart it. I'll try to get the specific error later, but iirc it said
something about a stack overflow.
On Oct 2, 2015 10:45 PM, "Pascal Craponne" [email protected] wrote:
Hi,
I'm aware of these two. I even had to ignore three errors in my peverify
call, here is the batch part in Mr. Advice which checks the generated
assemblies:rem muted errors as follow (not sure muting them is good, but they are no valid errors)
rem 0x801318BF because an advised ctor can call the base class ctor
rem 0x80131859 warning of 'this' being uninitialized in ctor
rem 0x8013184F because .ctor inner (wrapped original) method calls base..ctor()
%peverify% /nologo /hresult /ignore=0x801318BF,0x80131859,0x8013184F %1I'm open to suggestions if you know how to fix this anyway.
Pascal.
—
Reply to this email directly or view it on GitHub
#48 (comment).
from mradvice.
As a first step, try to apply the advices only at a type-level, not assembly-level, and even more, at method-level. Then we'll try to understand what's exactly causing the problem in order to solve it.
from mradvice.
I created a new project from MVC template to make sure that it wasn't something we were doing in the other solution that caused the problem.
I placed the simple advice on a method and the PEverify passed it.
I placed it on a controller class and PEverfify gave the following error. HOWEVER, the project still runs fine.
[IL]: Error: [C:\Users\Nate\Documents\Visual Studio 2015\Projects\MrAdviceProof\MrAdviceProof\bin\MrAdviceProof.dll : MrAdviceProof.Controllers.HomeController::.ctor][offset 0x00000001][found <uninitialized> ref ('this' ptr) 'MrAdviceProof.Controllers.HomeController'] Uninitialized item on stack.(Error: 0x80131859)
[IL]: Error: [C:\Users\Nate\Documents\Visual Studio 2015\Projects\MrAdviceProof\MrAdviceProof\bin\MrAdviceProof.dll : MrAdviceProof.Controllers.HomeController::.ctor?][offset 0x00000001][found ref ('this' ptr) 'MrAdviceProof.Controllers.HomeController'] Call to .ctor only allowed to initialize this pointer from within a .ctor. Try newobj.(Error: 0x801318BF)
2 Error(s) Verifying C:\Users\Nate\Documents\Visual Studio 2015\Projects\MrAdviceProof\MrAdviceProof\bin\MrAdviceProof.dll MrAdviceProof
When I placed it on the assembly, I get the same error repeated for a bunch of classes.
When I run it, the webapp crashes.
An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll
From looking at the errors, it looks like most of the issues are in constructors. I'm going to start looking at it, but I don't really know where to begin looking in the MrAdvice code.
from mradvice.
OK, I'll create an ASP.NET MVC project and check it!
from mradvice.
Just to know: is your advice in the same assembly, on in a separated one?
from mradvice.
Same assembly in the test project that I setup for this, but it will likely
end up in a separate assembly in production code.
On Oct 3, 2015 11:05 AM, "Pascal Craponne" [email protected] wrote:
Just to know: is your advice in the same assembly, on in a separated one?
—
Reply to this email directly or view it on GitHub
#48 (comment).
from mradvice.
An advice placed at assembly level will advice everything: constructors and methods of course, but it will also advise itself, which may lead to a stackoverflow. It should work if you place the advice in an external assembly.
from mradvice.
Confirmed: the advice advises itself. I've opened a new issue #49
Regarding your case, this should be solved if you place the advice in another assembly. Let me know!
from mradvice.
Placing the advice in another assembly did the trick.
However, I ran into a new bug when I applied the advice to the assembly:
System.InvalidCastException was unhandled by user code
HResult=-2147467262
Message=Unable to cast object of type 'System.Reflection.RuntimeConstructorInfo' to type 'System.Reflection.MethodInfo'.
Source=MrAdvice
StackTrace:
at ArxOne.MrAdvice.Aspect.AspectInfo.ApplyGenericParameters(Type[] genericArguments)
at ArxOne.MrAdvice.Invocation.GetAspectInfo(MethodBase methodBase, MethodBase innerMethod, Boolean abstractedTarget, Type[] genericArguments)
at ArxOne.MrAdvice.Invocation.ProceedAdvice(Object target, Object[] parameters, MethodBase methodBase, MethodBase innerMethod, Boolean abstractedTarget, Type[] genericArguments)
at <>f__AnonymousType0`2..ctor(<controller>j__TPar controller, <action>j__TPar action)
at MrAdviceProof.RouteConfig.RegisterRoutes(RouteCollection routes) in C:\Users\Nate\Documents\Visual Studio 2015\Projects\MrAdviceProof\MrAdviceProof\App_Start\RouteConfig.cs:line 19
InnerException:
The following code that came out of the MVC template is where this is coming from:
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index" }
);
}
}
When I modify it to take out the defaults:
parameter, I no longer get the error above. The modified code looks like this:
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}"
);
}
}
I don't know if this helps or not, but putting the advice on just the RouteConfig class doesn't cause the exception.
from mradvice.
Confirmed, there was a bug with constructors in anonymous classes (generic classes, actually), this is fixed in package 1.1.6.
from mradvice.
Thanks! I updated the package and the project is working perfectly.
from mradvice.
Related Issues (20)
- Parameter for Parameter Advice HOT 2
- Example - Advice for Event handlers HOT 6
- Wrong order of advices in class libraries HOT 5
- Failed to emit module HOT 4
- dotnet publish throw exception when use --self-contained HOT 8
- Add Changelog HOT 2
- 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
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.