Questions tagged [postsharp]
PostSharp is a pattern-aware extension to C# and VB, reducing boilerplate code involved in implementing design patterns. It is based on aspect-oriented programming and static analysis.
914
questions
1
vote
0
answers
34
views
PostSharp dependency sprawl
I defined a custom attribute 'attribute' in a library 'Lib' that I use to annotate a method 'method' in a project 'Service'. However, when unit testing 'method' (in a distinct unit test project that ...
1
vote
1
answer
30
views
PostSharp Detected .NET Core SDK 7
I have a project targeting NET 6.0 framework.
When I build the project, I’m getting this message
Warning
Detected .NET Core SDK 7.0.100. This SDK version was not tested on this version of PostSharp. ...
0
votes
1
answer
23
views
How to apply multiple aspects in PostSharp on a method?
Considering these two aspects:
public class MyAspect1 : OnMethodBoundaryAspectAttribute
{
public override void OnEntry(MethodExecutionEventArgs args)
{
// doing some checks.....
0
votes
1
answer
34
views
Postsharp support for visual studio 2017 , 2019 and 2022
One of our application framework we are using postsharp version 6.3.13 which is supporting us on Visual studio 15 , 17 and 19. Is there any postsharp stable version available which can support for ...
1
vote
0
answers
54
views
An Error Occurred in PostSharp.targets on Visual Studio 2022 For Mac
I am working on a .Net 6/AspNet Core project in VS for Mac 2022 that includes aspects and the first one is FluentValidationAspect. And when I made a unit test about that aspect, I got two errors and ...
0
votes
1
answer
88
views
PostSharp compilation issue. Visual Studio 2022
I have started getting following errors on projects containing PostSharp 6.6.6 nuget in Visual Studio 2022(64bit Version 17.3.6).
Warning PS0219 The targeting pack for platform ".NETFramework,...
0
votes
0
answers
28
views
Adding Postsharp to a VS2022 library project with two TargetFrameworks - Net48 and Net6
I get the following two errors when building the project:
Severity Code Description Project File Line Suppression State
Error error: Unhandled exception (postsharp-x86-srv.exe 6.10....
0
votes
1
answer
17
views
How can I get PostSharp to emit a message to the build window in VisualStudio for my Aspect
I have an aspect (attribute) that I want to be sure is being added to the correct classes/events during compile time (technically, after compile time when PostSharp is instrumenting the code), so I ...
0
votes
1
answer
370
views
Visual Studio 2022. Feature 'Edit and Continue' is currently unavailable due to an internal error. Read out of bounds
Suddenly I have started to get aforementioned issue during debugging unit tests.
Here is a situation:
Open project and open Tests Explorer.
Select any test and try to debug it.
Got message from title ...
1
vote
1
answer
36
views
Exception in .NET strong name API invocation. Error while getting key info for '<my .snk file path>': Strong name key container not found
I have a C# class library project which uses Postsharp, which is unable to build. I am getting the following error:
Exception in .NET strong name API invocation. Error while getting key
info for '<...
0
votes
1
answer
28
views
build errors when upgrade postsharp from 4.2.25 to 4.3.48
I am very new to postsharp. In our project we are using postsharp C# to develop a web service. When we try to upgrade postsharp from 4.2.25 to 4.3.48, I encounter the below issues:
1>POSTSHARP : ...
0
votes
1
answer
214
views
Postsharp Error after updating newtonsoft
I have a .net framework solution, that uses postsharp version 4.2.21.0.
I have a demand to upgrade our newtonsoft.json package from 11.0.2 to 13.0.1. After this upgrade, solution became unable to ...
0
votes
1
answer
31
views
PostSharp Logging line by line
Does PostSharp support logging each line executed, or just function calls?
I have a program that randomly fails two or three times a week. I want to see the line and related info that the code is ...
1
vote
1
answer
153
views
Logging Parameter Values in LinqPad 7 C# (.NET Core/5/6) with Metalama
From what I understand, the code needs to be compiled (the same way VS compiles code) for OverrideMethodAspect to work. But LinqPad compiles the code with Roslyn.
Any ideas on how to get ...
0
votes
1
answer
52
views
Exceptions are simply not caught by PostSharp
Well, I don't get it. Trying to apply a PostSharp attribute for exception handling on a method, the aspect's OnException method is simply not reached by any means. This is very disappointing.
For the ...
0
votes
0
answers
77
views
Postsharp compile error Ambiguous match System.Runtime.InteropServices
I'm trying to add PostSharp Logging to a .NET Framework app. I'm getting this error. How do I resolve it? Is there a way to tell PostSharp which type it should map to?
Unhandled exception (...
0
votes
2
answers
30
views
Mac - VS 8.10 - New 3.1 Project - Install Postsharp
I created a new, console application. Nuget => Add PostSharp =>
Reading project file
/Users/jason/Projects/Postsharp/Postsharp/Postsharp.csproj.
Restoring packages for
/Users/jason/Projects/...
0
votes
2
answers
227
views
#postsharp Unable to compile after adding PostSharp.Community nuget package (on a Mac)
I'm using a Mac with Visual Studio 2019. I've added nuget packages: PostSharp and PostSharp.Community. I have NOT changed any code. I wasn't NOT prompted to select a license. I'm simply trying to ...
0
votes
2
answers
560
views
Unable to build solution using PostSharp in Visual Studio 2022 after moving code to new computer
I've just recently started using a newly installed PC but am having trouble building a solution in Visual Studio 2022 that uses PostSharp (version 6.10.5). It works without problem to build the same ...
1
vote
1
answer
63
views
Sharing data between aspects in different assemblies during compile time
I have a custom TypeLevelAspect called PersistentId which is used on types in several assemblies. I need to store information from these aspects during compile time and use it during runtime - but ...
2
votes
1
answer
239
views
PostSharp Logging Add >>> and <<< to Method Entry/Exit Log Entries
Can someone please tell me if it's possible to add >>> and <<< to the log entries made by PostSharp Logging at method entry and exit? If it's possible, can someone please help get ...
1
vote
1
answer
207
views
How to have PostSharp included in build process for ASP.NET WebApi project when installed using our own Nuget package?
We have a class library (C#, .NET 5) where we've added a reference to the PostSharp nuget-package (using PackageReference in our csproj-file) and implemented a PostSharp OnMethodBoundaryAspect. This ...
2
votes
0
answers
248
views
PostSharp support on M1 Macs (linux-arm64)
I've recently started using PostSharp for caching on a .NET 5 app and it's working phenomenally on my 2015 MacBook Pro (Intel). However, I just recently got an M1 Mac Mini, which has Apple's own M1 ...
1
vote
1
answer
285
views
Postsharp DTO request validation & controller wide validation exception handling
I'm trying to put PostSharp to use in a WebAPI project. I can't wrap my head around this task. I'd like to use PostSharp contracts to validate incoming DTOs and centralize exception handling in case ...
0
votes
1
answer
100
views
Postsharp Aspect class OnEntry Method is not calling from web api controller
As, I am working on web api project and trying to implement the PostSharp Aspect class to loggin the request and other staff. OnEntry method OnSucess method is not getting called when api method is ...
0
votes
1
answer
105
views
How do I write my Aspect classes and my problem solves?
I have 2 errors because of my little knowledge of PostSharp (last version). My project's three aspect classes, but I only get 2 errors. When the getall method runs in my mvc project, I want log ...
0
votes
0
answers
629
views
Log4net is not working in .net core class library
I am logging with AOP. I wrote aspect for logging. When the program is running, the logging functions work, but neither the database nor a file is logged. I don't know if there is a configuration that ...
0
votes
1
answer
186
views
Error MSB4064: The "NETCoreSdkRuntimeIdentifier" parameter is not supported by the "PrepareForReadyToRunCompilation" when use PostSharp
I am trying to compile a solution with a .netstandard 2.0 projects in vs 2019(v16.10)
and I got this error message (I use PostSharp):
Error MSB4064 The "NETCoreSdkRuntimeIdentifier" ...
1
vote
1
answer
132
views
OnEntry method not working, when using postsharp for AOP
Hi I am trying to use postsharp aspect for validation. FluentValidationAspect does not working for OnEntry method. (postsharp v6.9.6)
FluentValidationAspect
[Serializable]
public class ...
0
votes
1
answer
42
views
How to add attributes to aspect/compiler-generated property?
I'm adding a property to a class and have my Aspect set up like this:
[PSerializable]
public class MyAspect : InstanceLevelAspect
{
[MaxLength(100)]
[IntroduceMember]
public string MyProp {...
0
votes
1
answer
61
views
Properties Added with Aspects Not in Generated JSON Schema
I'm trying to generate JSON Schemas using Newtonsoft JSON Schema. Regular properties added in my POCO class are added to the schema when it is generated. I'm also using PostSharp Aspects to add ...
-2
votes
1
answer
67
views
Property resets when changing Usercontrols DependencyProperty
I've constructed a "Manager" of "Widgets" where i have a ListView/GridView with widgets.
The ListView binds the SelectedItem to a SelectedWidget property on the (Manager) ViewModel....
0
votes
0
answers
63
views
Constructor NotImplementedException?
I am starting and doing testing with PostSharp 6.9.4 Community version, upgrading from 3.0.27 Express. Everything is fine building in VS2017, but when we queue a new build in tfs we get this error:
c:\...
0
votes
1
answer
781
views
MVVM "A 'Binding' can only be set on a DependencyProperty of a DependencyObject."
I have this Model
[NotifyPropertyChanged]
public class WidgetConfiguration
{
#region Properties
#endregion Properties
}
Which i use in my ViewModel for a Collection and a Selected item ...
1
vote
1
answer
87
views
How do I use postsharp logging to write to applicationInsights? and How do I test that the logs are being written to application Insights?
I was trying to use application Insights as my logging backend from postsharp references. I have setup the application insights and was able to see live metrics. But I am not quite sure if postsharp ...
1
vote
1
answer
383
views
How to use PostSharp.Community.Packer
I installed PostSharp.Community.Packer via Visual Studio 2019 Nuget Manager and restarted.
I tried adding [assembly: Packer] at the end of my code, but it does not read. I can't build because I think ...
0
votes
1
answer
41
views
How to intercept calls to ICommand.Execute in PostSharp?
I'm new to PostSharp, and I want it to trace GUI interactions in my MVVM application. The idea was to use OnMethodBoundaryAspect to intercept calls to ICommand's Execute method.
Interception works ...
1
vote
2
answers
86
views
PostSharp: Include some classes or some methods only
I need to add logging to a specific class or a specific method only.
Reading documentation here and here I cannot find a way to reach my goal.
Listed below are my test cases.
namespace ClassLibrary1....
1
vote
1
answer
75
views
Get rid of aspect conflict warnings between OnMethodBoundaryAspect and ILocationValidationAspect?
PostSharp version 6.7.12 for both tooling and libraries. I have a few custom attributes defined:
[PSerializable]
public sealed class CheckInvariantAttribute : OnMethodBoundaryAspect
{
// Snip - ...
1
vote
1
answer
38
views
Using postsharp how to customize OnEntry logging text?
How to customize postsharp logging text inside onEntry method in c#. Look at the screenshot, here first line is mehod_abc starting. In next line I can see the total execution time. I want to eliminate ...
0
votes
1
answer
117
views
Using postSharp how to capture all method entry and exit event at class level?
Using postsharp I can capture entry and exit event for a method when I apply my custom attribute on that method. But is there any way to capture this entry and exit of a method when I apply the ...
1
vote
2
answers
1k
views
Postsharp Build Errors after Update to Visual Studio Version 16.8.2
After updating visual studio to version 16.8.2, my solution which uses Post Sharp no longer builds. I didn't upgrade any projects to use .Net 5. Here are the errors I'm seeing:
Severity Code ...
4
votes
1
answer
125
views
How can I apply postsharp aspect to a website project?
I use a simple postsharp.config file :
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.postsharp.org/1.0/configuration">
<Multicast ...
3
votes
1
answer
96
views
PostSharp and Blazor
I'm looking at using PostSharp on a Blazor server project and was wondering if the limitation/restrictions outlined in this Postsharp blog (https://blog.postsharp.net/post/blazor-support-6.7.html) ...
1
vote
1
answer
49
views
Postsharp recatch exception beeing caught and rethrown by itself
I want to be able to catch exception with the Postsharp OnMethodBoundary.OnException. But only once. Let me explain.
I have these method :
public void FooV1(){
throw new NotYetImplementedException(...
0
votes
1
answer
513
views
Why does postsharp says I use a premium feature while afaik I don't?
I use postsharp and I'm using the OnMethodBoundaryAspect and according to this it is available in the community edition. This is litteraly the only aspect I'm using.
I'm am however using a postsharp....
-1
votes
1
answer
62
views
What modifications postsharp bring to the cilof my method that prevent me from editing the cil code?
I have this method:
public string NestedFoo(SampleClass bar)
{
var1 = "value set in NestedFoo()";
Var2 = "value set in NestedFoo()";
...
2
votes
2
answers
780
views
PostSharp won't build in latest Visual Studio (16.8.1)
Since upgrading to the latest Visual Studio (16.8.1), I can no longer compile any projects that use PostSharp.
I receive the following build errors (for PostSharp v6.7.11 AND for 6.8.1-preview):
1>...
0
votes
2
answers
608
views
Why field isn't set during json deserialization?
I have a serialized object which looks like this :
{
"Var4": "value set in Foo()",
"var3": "value set in NestedFoo()",
"<var3>k__OriginalField&...
0
votes
2
answers
345
views
Postsharp: Requested targeting pack NETStandard.Library.Ref not installed
I have a brand new Solution File containing a brand new .NET Core 3.1 console application. Whenever I add the Discord.NET package to this project, PostSharp fails to compile with the following error:
...