.net-4.0

Derived types must either match the security accessibility of the base type or be less accessible in very basic case

谁都会走 提交于 2019-12-08 12:38:58
问题 Build the sample code, and run any test. (I tried abs .) Each time I do it, I get TypeLoadException : An exception of type 'System.TypeLoadException' occurred in Jurassic.dll but was not handled in user code Additional information: Inheritance security rules violated by type: 'Jurassic.Compiler.WhiteSpaceToken'. Derived types must either match the security accessibility of the base type or be less accessible. The problem is WhiteSpaceToken is a simple class, as so is Token , its base. So it

WCF REST Authentication behavior

醉酒当歌 提交于 2019-12-08 12:35:14
问题 I want to be able to authenticate a WCF Rest webservice but I'm not really sure how to go about it. It looks like many of the other questions relate to stuff in .net 3.5 WCF (such as WebServiceHost2) which no longer seems to exist. I am wanting to do message based authentication on the WCF service with custom usernames and passwords. From what I can tell this can be done by the following in regular WCF: <behaviors> <serviceBehaviors> <behavior name="PasswordValidator"> <serviceCredentials>

CheckBox Command Behaviors for Silverlight MVVM Pattern

馋奶兔 提交于 2019-12-08 11:37:00
问题 I am trying to detect when an item is checked, and which item is checked in a ListBox using Silverlight 4 and the Prism framework. I found this example on creating behaviors, and tried to follow it but nothing is happening in the debugger. I have three questions: Why isn't my command executing? How do I determine which item was checked (i.e. pass a command parameter)? How do I debug this? (i.e. where can I put break points to begin stepping into this) Here is my code: View: <ListBox x:Name=

UIP Application Block in .NET 4

我的梦境 提交于 2019-12-08 11:13:11
问题 I am involved in migrating a legacy application built in .NET 1.1 to .NET 4. Is UIP (User Interface Process) still available in the latest released of EnLib 5? If no, what are my options? Regards, Karan Misra 回答1: Assuming you are talking (as in the Title of your question) about the User Interface Process Application Block, there have been no new official releases since 2004, as you can read here. The options you are talking about really depend on the usage UIP was given. Take into account

Simplest way to get an interactive console for my app

蹲街弑〆低调 提交于 2019-12-08 10:04:34
问题 I want a simple, interactive way to demo middle-tier features of my app which have not had a UI created yet. I want an interactive console. When my application (WPF but it shouldn't matter) boots up I would like to also start a console window. This window should run powershell (or ruby, or python, but preferably powershell) and have its scope set to access my ServiceLocator. Alternately, I could start up my app and attach to the process appdomain from an external powershell window and grab a

WPF handling missing dlls

两盒软妹~` 提交于 2019-12-08 10:04:29
问题 I have noticed that in some situations, where I do not distribute a particular dll, which is required by application, the application doesn't not provide any errors, it just does not load (show on screen). It behaves like you haven't started it. Does anyone know why is this happening? Edit: Steps to reproduce: Create a solution with WPF app project and class library project (ReferenceDll). Add reference in WPF app project to class library project. In class library, add this method to Class1

query a list of dynamic objects for a FirstOrDefault

随声附和 提交于 2019-12-08 09:59:02
问题 The following code will return an Enumerable of dynamic objects. protected override dynamic Get(int id) { Func<dynamic, bool> check = x => x.ID == id; return Enumerable.Where<dynamic>(this.Get(), check); } How do I select the FirstOrDefault so it is a single object not an Enumerable? Similar to this answer but just want SingleOrDefault. 回答1: Simplest way is probably protected override dynamic Get(int id) { return Get().FirstOrDefault(x=>x.ID==id); } Since some people have had trouble making

Rendering a control generates security exception in .Net 4

大兔子大兔子 提交于 2019-12-08 07:10:28
I am having a problem with code that worked fine in .NET 2.0 but is giving this error under .Net 4. Build (web): Inheritance security rules violated while overriding member: 'Controls.RelatedPosts.RenderControl(System.Web.UI.HtmlTextWriter)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden. This is in DotNetBlogEngine. There were several other security demands in the code that .NET 4.0 doesn't seem to like. I followed some of the advice I found on blogs (and here) and got rid of all the other errors. But this one still eludes

Cannot Resolve Symbol Exception When Passing Runtime Type

牧云@^-^@ 提交于 2019-12-08 06:54:28
问题 I have a JSON deserializer (shown below) which works perfectly fine when I call it with a known type. public static T Deserialize<T>(this object obj) { var javaScriptSerializer = new JavaScriptSerializer(); return (obj != null) ? javaScriptSerializer.Deserialize<T>(obj.ToString()) : default(T); } So this call will work: var newExampleTypeX = exampleJsonString.Deserialize<ExampleTypeX>(); However, what I'm trying to do is pass in a type which is set at runtime and use it in place of the

create Wpf user controls in other thread

拥有回忆 提交于 2019-12-08 06:49:45
问题 I am trying to create some UserControl(s) using another thread, and I am using code like this: private void btnDemo_Click(object sender, RoutedEventArgs e) { Task tsk = Task.Factory.StartNew(() => { for (int i = 0; i < 3; i++) { MyControl sprite = new MyControl(); pnlTest.Children.Add(sprite); } }); } But I am getting this exception in the UserControl constructor: The calling thread must be STA, because many UI components require this. I am not sure that I am using the right approach to do