Questions tagged [reflectionpermission]
8 questions
6
votes
6 answers
NULL reference exception while reading user sessions (Reflection)
I have implemented the code for reading the active sessions using the reference Reading All Users Session and Get a list of all active sessions in ASP.NET.
Private List getOnlineUsers()
{
List activeSessions = new…

TechDo
- 18,398
- 3
- 51
- 64
5
votes
1 answer
how to add Reflection Permission to IIS or to add it to web.config?
I'm using FileHelpers for reading csv files, and all it was ok until I switched from VS dev server to IIS, I get a "PolicyException: Required permissions cannot be acquired", I googled and found that I need to add Reflection Permission for this to…

Omu
- 69,856
- 92
- 277
- 407
4
votes
3 answers
HttpRuntime CacheInternal NULL reference exception while reading user sessions (Reflection)
After some updates on our windows servers(2008R2 ,2012) Asp.net application throwing error:
var obj_1 = typeof(HttpRuntime).GetProperty("CacheInternal", BindingFlags.NonPublic | BindingFlags.Static);
CacheInternal is coming null, dont know why…

sarvesh kushwaha
- 342
- 1
- 3
- 19
2
votes
0 answers
How to grant ReflectionPermission with RestrictedMemberAccess to my application C#
When I call GetTypes on the assembly I cannot see internal and private classes.
I read I can get internal and private classes by adding RestrictedMemberAccess but I don't know how to do it.
Assembly assemlib =…

rodolk
- 5,606
- 3
- 28
- 34
1
vote
1 answer
ReflectionPermission problems when using Ninject 2.2, Fluent NHibernate in a Medium Trust environment
I am using (from Nuget packages) Ninject 2.2 and Fluent NHibernate 1.3 (NHibernate v3.2 under the hood) and I've hit a brick wall.
I am using Fluent config to point to my database, mappings etc:
var fluentConfig = Fluently.Configure()
…

Greg
- 31,180
- 18
- 65
- 85
1
vote
2 answers
How to access anonymous fields in a dynamic assembly?
.net Framework 4.7.2...
Compiled expressions can access private fields. When I use exactly the same expression and write it to a dynamic assembly, using CompileToMethod, I get a System.FieldAccessException while trying to read the private field.
Is…

Robin Davies
- 7,547
- 1
- 35
- 50
1
vote
1 answer
NHibernate + Remoting = ReflectionPermission Exception
We are dealing with a problem when using NHibernate with Remoting in a machine with full trust enviroment (actually that's our dev machine).
The problem happens when whe try to send as a parameter an object previously retrieved from the server, that…

Pedro
- 11,514
- 5
- 27
- 40
1
vote
1 answer
Restrict reflection on private literal fields
I'm trying to build a sandbox using an app-domain to isolate execution of potentially bad code.
Among other things I'd like to restrict reflection.
I'm building the sandbox this way:
AppDomainSetup sandboxSetup = new AppDomainSetup
{
…

Pragmateek
- 13,174
- 9
- 74
- 108