Code Monkey home page Code Monkey logo

puresharper / puresharp Goto Github PK

View Code? Open in Web Editor NEW
143.0 143.0 17.0 179 KB

Puresharp is a Framework that provides the essential APIs (AOP, IOC, etc...) to productively build high quality (.NET 4.5.2+ & .NET Core 2.1+) applications through reliability, scalability and performance without no compromise

License: MIT License

C# 100.00% Smalltalk 0.01%
advice aop architecture aspects composition csharp framework injection interception ioc net proxy

puresharp's People

Contributors

puresharper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

puresharp's Issues

Support .NET Core SDK Projects

Currently the project does not support .NET Core projects (even if targeting net472).

The reason for this is the wrong location to the IPuresharp.exe. With .NET Core SDK templates, the "packages" folder inside solution root is not used anymore.

For me it is located at C:\Users\USERNAME\.nuget\packages\ipuresharp\4.2.1 instead.

Build error when you have a static async method

Hi,

Using version 4.2.2 I get a build error whenever there is a static asynchronous method in a class. The simplest example I can give is just to create the following class in an empty class library

public class TestService
    {
        public DateTime GetDateAddDays(int daysToAdd)
        {
            return DoDateAddition(daysToAdd).Result;
        }

        private static async Task<DateTime> DoDateAddition(int daysToAdd)
        {
            return DateTime.Now.AddDays(daysToAdd);
        }
    }

Reference the puresharp libraries and do a build.

It fails with the following error

Unhandled Exception: System.ArgumentNullException: Value cannot be null.
	Parameter name: field
       at Mono.Cecil.Cil.Instruction.Create(OpCode opcode, FieldReference field)
       at IPuresharp.Machine.Manage(MethodDefinition method)
       at IPuresharp.Authority..ctor(TypeDefinition type)
       at IPuresharp.Program.Manage(TypeDefinition type)
       at IPuresharp.Program.Manage(String assembly)
       at IPuresharp.Program.Main(String[] arguments)
C:\Temp\PureSharp\Repro\PureSharpBug\packages\IPuresharp.4.2.2\build\IPuresharp.targets(10,5): error MSB3073: The command ""C:\Temp\PureSharp\Repro\PureSharpBug\packages\IPuresharp.4.2.2\build\IPuresharp.exe" "C:\Temp\PureSharp\Repro\PureSharpBug\PureSharpBug\PureSharpBug.csproj" "Debug"" exited with code -532462766.

Async methods cause null reference exception

When I pass a .NET Core 2.2 exe to IPuresharp, it fails if the exe has async methods that contain certain constructs:

using System;
using System.Threading.Tasks;

namespace AsyncWeavingTest
{
    class Program
    {
        static void Main(string[] args) { }

        // Works
        Task Method1() => Task.CompletedTask;
        void Method2() { var t = new Task(() => { }); t.Start(); }
        async Task Async1() { }
        async Task Async2() { var t = new Task(() => { }); t.Start(); }
        async Task Async3() { await new Task(() => { }); }

        // Fails
        async Task Async4() { var t = new Task(() => { }); t.Start(); await t; }
        async Task Async5() { await Task.CompletedTask; }
    }
}

Also, thank you for this project. I was looking for a decent AOP solution for quite a while.

Add method arguments to IAdvice.Begin

IAdvice.Begin doesn't have method arguments

Arguments needed for templates, such as

[Log("My method: {value}")]
void MyMethod(string value);

IAdvice.Begin can be

void Begin(object[] args);

Puresharp fails on build with error code -532462766

When I try to build and start my Asp.Net Web API, I get the error:

Unhandled Exception: System.ArgumentException: Value does not fall within the expected range.
1>     at Mono.Cecil.Pdb.ISymUnmanagedWriter2.DefineLocalVariable2(String name, Int32 attributes, Int32 sigToken, Int32 addrKind, Int32 addr1, Int32 addr2, Int32 addr3, Int32 startOffset, Int32 endOffset)
1>     at Mono.Cecil.Pdb.NativePdbWriter.DefineScope(ScopeDebugInformation scope, MethodDebugInformation info, MetadataToken& import_parent)
1>     at Mono.Cecil.Pdb.NativePdbWriter.DefineScope(ScopeDebugInformation scope, MethodDebugInformation info, MetadataToken& import_parent)
1>     at Mono.Cecil.Pdb.NativePdbWriter.Write(MethodDebugInformation info)
1>     at Mono.Cecil.Cil.CodeWriter.WriteResolvedMethodBody(MethodDefinition method)
1>     at Mono.Cecil.Cil.CodeWriter.WriteMethodBody(MethodDefinition method)
1>     at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method)
1>     at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type)
1>     at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)
1>     at Mono.Cecil.MetadataBuilder.AddTypes()
1>     at Mono.Cecil.MetadataBuilder.BuildTypes()
1>     at Mono.Cecil.MetadataBuilder.BuildModule()
1>     at Mono.Cecil.MetadataBuilder.BuildMetadata()
1>     at Mono.Cecil.ModuleWriter.<>c.<BuildMetadata>b__2_0(MetadataBuilder builder, MetadataReader _)
1>     at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
1>     at Mono.Cecil.ModuleWriter.Write(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters)
1>     at Mono.Cecil.ModuleWriter.WriteModule(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters)
1>     at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
1>     at IPuresharp.Program.Manage(String assembly)
1>     at IPuresharp.Program.Main(String[] arguments
1>C:\Users\myuser\source\repos\RedisTest\packages\IPuresharp.5.0.5\build\net452\IPuresharp.targets(10,5): error MSB3073: The command ""C:\Users\myuser\source\repos\RedisTest\packages\IPuresharp.5.0.5\build\net452\IPuresharp.exe" "C:\Users\myuser\source\repos\RedisTest\RedisTest\bin\RedisTest.dll"" exited with code -532462766.)

The error is not very descriptive.

I'm using Puresharp 5.0.5 with Visual Studio 2019.

Feeback

Hi everyone,

Don't hesitate to leave me here some comments to encourage me... or not :)
Just tell me what you want or need here about this project.

AssemblyResolutionException on attempt to build project using Puresharp

The following error appears during building a project in VS:

7>Unhandled Exception: Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
7>   at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
7>   at Mono.Cecil.DefaultAssemblyResolver.Resolve(AssemblyNameReference name)
7>   at IPuresharp.Authority.Modules(AssemblyDefinition assembly)
7>   at IPuresharp.Authority.Modules(AssemblyDefinition assembly)
7>   at IPuresharp.Authority.Include(AssemblyDefinition assembly, Assembly[] dependencies)
7>   at IPuresharp.Authority.Manage(TypeDefinition type, MethodDefinition method)
7>   at IPuresharp.Authority..ctor(TypeDefinition type)
7>   at IPuresharp.Program.Manage(TypeDefinition type)
7>   at IPuresharp.Program.Manage(String assembly)
7>   at IPuresharp.Program.Main(String[] arguments)

And VS logs this error:
The command ""%USERPROFILE%\.nuget\packages\IPuresharp\5.0.5\build\net452\IPuresharp.exe" "C:\Sources\path_to_My.Internal.Company.Assembly.dll"" exited with code -532462766. My.Internal.Company.Assembly C:\Users\myuser\.nuget\packages\ipuresharp\5.0.5\build\netcoreapp2.1\IPuresharp.targets 11

Container..?

How come this line from your examples doesn't work?

var _container = new Container(_composition);

Cannot create an instance of the container, that was kind of a showstopper... moving on to StructureMap :P

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.