You've answered this question yourself already:
This solution references prohibited type
System.Reflection.BindingFlags and cannot be used on this site
collection.
You can't use the System.Reflection
namespace with SharePoint Online solutions (for the most part). The only allowed members from System.Reflection
are:
- GetValue Name
- GetCustomAttributes
- PropertyType
- GetValue SetValue
I recommend taking a look at Microsoft's documentation for developing SharePoint Online solutions (link) as there are quite a few namespaces previously available for SharePoint development that are now prohibited.
Here's what Microsoft has to say about this:
Because it is a multi-tenant environment, when you upload a sandboxed
solution to the Solution Gallery, SharePoint Online performs a further
round of validation checks, in addition to those performed by
on-premise SharePoint installations. A sandboxed solution cannot be
activated if it contains code calling any of the following namespaces:
And here's the list of prohibited namespaces (see documentation for all exceptions):
- Microsoft.SqlServer
- Microsoft.Win32
- System.Data.Sql
- System.Data.SqlClient
- System.Data.SqlTypes
- System.IO.Pipes
- System.IO.Ports
- System.Reflection
- System.Runtime.InteropServices
- System.Runtime.Remoting
- System.Threading
- Array.CreateInstance()
- System.Delegate
- Type.GetType(String)
- Type.InvokeMember()