NET fiddle error when invoking Castle Windsor

0 votes

I'm attempting to demonstrate a simple Castle Windsor edge case using dotnetfiddle.

When it tries to run this code

             var container = new WindsorContainer()
                         .Register(Component.For<TestClass>()
                                     .LifeStyle.Singleton
                                     .OnDestroy(t => t.ByeBye())
                                   );

It gets this error

Run-time exception (line 42): Inheritance security rules violated while overriding member: 'Castle.MicroKernel.DefaultKernel.InitializeLifetimeService()'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.

Stack Trace:

[System.TypeLoadException: Inheritance security rules violated while overriding member: 'Castle.MicroKernel.DefaultKernel.InitializeLifetimeService()'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.] at Program.Main(String[] args): line 42

Is there a way to get Castle Windsor to work with.NET fiddle?

Here's the link to the.NET fiddle share: https://dotnetfiddle.net/crBGpt

Jun 9, 2022 in C# by pranav
• 2,590 points
492 views

1 answer to this question.

0 votes
It does, in fact, have something to do with.netFiddle's Medium Trust. If you really need to run it under Medium Trust, you can change the code.

Instead of testing the Castle portion of your code under Medium Trust, I would propose focusing on the moving portions of your application and leave the Castle behaviour to its own tests (which you could run on the side on another machine)
answered Jun 9, 2022 by rajiv
• 1,620 points

Related Questions In C#

0 votes
1 answer

Why program working differently on every run when using async?

You can use the async Main method ...READ MORE

answered May 30, 2022 in C# by rajiv
• 1,620 points
565 views
0 votes
1 answer

Questions every good .NET developer should be able to answer?

If I were interviewing someone who knew ...READ MORE

answered May 30, 2022 in C# by rajiv
• 1,620 points
772 views
0 votes
1 answer

Convert VB.NET --> C# Projects

You may decompile whole Assemblies into Visual ...READ MORE

answered May 31, 2022 in C# by anonymous
759 views
0 votes
1 answer

.NET Guitar Chord Library

It is true that finding something is ...READ MORE

answered Jun 6, 2022 in C# by pranav
• 2,590 points
460 views
0 votes
3 answers

Trying to upload files using Selenium(C#)

You can try using Javascript Executor to ...READ MORE

answered Aug 23, 2019 in Selenium by Abha
• 28,140 points
5,723 views
0 votes
1 answer

Deploy my Windows 10 IOT core application locally!

Of course, you, can! That is, in ...READ MORE

answered Jul 17, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
1,114 views
+6 votes
16 answers

How do backend of these really cool games work?

Most of the games these days don't ...READ MORE

answered Jul 19, 2018 in Career Counselling by Kalgi
• 52,350 points
11,311 views
0 votes
1 answer

SQLite.Net not being able to create text file in Win IoT Library!

That exception comes when access limited to ...READ MORE

answered Aug 3, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
1,014 views
0 votes
1 answer

Convert VB.NET --> C# Projects

You may decompile whole Assemblies into Visual ...READ MORE

answered May 30, 2022 in C# by rajiv
• 1,620 points
610 views
0 votes
1 answer

What is the best C# to VB.net converter

Telerik has a solid SharpDevelop-based converter that ...READ MORE

answered May 30, 2022 in C# by rajiv
• 1,620 points
1,596 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP