GithubHelp home page GithubHelp logo

byme8 / apparatus.aot.reflection Goto Github PK

View Code? Open in Web Editor NEW
48.0 48.0 3.0 128 KB

Reflectionless reflection

License: MIT License

C# 95.96% PowerShell 4.04%
aot-compatible csharp reflection roslyn source-generators

apparatus.aot.reflection's People

Contributors

acchrisjensen avatar breadth avatar byme8 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

Watchers

 avatar  avatar

apparatus.aot.reflection's Issues

A question about the library

Hi there,
Can I use this library for dynamically loading assemblies (like plugins) at the runtime like I currently do with reflection?
Today I'm using reflection to:

  • load an assembly at runtime
  • unload an assembly at runtime
  • execute methods in the loaded assembly

Thank you for your work! You've already got my star :)

Can you add GetMethods()

I was wondering if you could have a generic way to solve:

public Frame(StackFrame? frame)
{
    _methodBase = frame.GetMethod();
}


When you look at the inplementation you can see that it's not available in IOT

///


/// Returns the method the frame is executing
///

[RequiresUnreferencedCode("Metadata for the method might be incomplete or removed")]
public virtual MethodBase? GetMethod()
{
return _method;
}

       ```

if (exception is not null && exception.GetType().Name.Equals("SqlException", StringComparison.OrdinalIgnoreCase))
{
#pragma warning disable IL2075 // 'this' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The return value of the source method does not have matching annotations.
var props = GetExceptionTypeWithProperties(exception).GetProperties(BindingFlags.Public | BindingFlags.Instance);
#pragma warning restore IL2075 // 'this' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The return value of the source method does not have matching annotations.

            foreach (var property in props)
            {
                //sqlException
                switch (property.Name)
                {
                    case "Procedure":
                        _sqlProcedureName = property.GetValue(exception) as string;
                        break;

                    case "LineNumber":
                        if (property.GetValue(exception) is int iSqlLineNumber)
                            _sqlLineNumber = iSqlLineNumber;
                        break;

                    case "Number":
                        if (property.GetValue(exception) is int iSqlErrorNumber)
                            _sqlErrorNumber = iSqlErrorNumber;
                        break;

                    case "Server":
                        _sqlServer = property.GetValue(exception) as string;
                        break;

                    case "Source":
                        _tSql = property.GetValue(exception) as string;
                        break;

                    case "ErrorCode":
                        if (property.GetValue(exception) is int iSqlErrorCode)
                            _sqlErrorCode = iSqlErrorCode;
                        break;
                }
            }
        }
            
SqlException comes from more than one namespace and in my lib I do not reference any of them but I am still interested in sending crash diagnostics without having to write a special resolver for it.


do not generate for private classes

If you have a class

partial class Person
{
    [Required]
    public string FirstName { get; set; }
    public string LastName { get; set; }
}

then compiling gives the error:

error CS0051: Inconsistent accessibility: parameter type 'Person' is less accessible than method 'CopyConstructor_PersonExtensions.GetProperties(Person)'
1>Done building project "ApparatusAOT.csproj" -- FAILED

No license

I know this is a bit of a non-issue, but could you please put a license on the project? In legal terms nobody's allowed to interact with your code if you don't. No viewing, no modifying, no using, Nothing at all. (Same for the nuget package)

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.