.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

how do I set a public argument type at runtime?

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :Windows Application

I've been attempting to set the datatype of an input argument in the CacheMetadata override with no luck. Essentially I need this: InArgument<typeof(property named ID in type(T))>. My code seems to compile correctly, it just fails to persist the value on ID. Here's my attempt:

using System;
using System.Activities;
using System.Activities.Presentation;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Linq;
using System.Reflection;
using Client.Api.Entities;

namespace Client.Api.Activities
	[ActivityDesignerOptions(AllowDrillIn = false)]
	[DisplayName("Get Entity <TEntity>")]
	public class GetEntityActivity<TEntity> : NativeActivity where TEntity : DataContractBase
		[Browsable(true), Categor

View Complete Post

More Related Resource Links

Variable/Argument Type List

Hi I wish to restrict or supply my own list of (Variable/Argument) types to a rehosted Workflow Designer. Is this definatley not possible? I have read http://social.msdn.microsoft.com/Forums/en-US/wfprerelease/thread/53c91c81-02cf-4eab-b43f-c3d73a03c501, where it appears it is not. I find it difficult to believe I cannot get some sort of control of how these drop downs are populated. Could someone please confirm categorically that this is or is not possible. Regards DarremDarren

the type initializer for 'system.runtime.remoting.identity' threw an exception.

HI, I am trying to implement kerberos delegation in Active Directory enviroment with windows 2003 servers SP2. I have Client, ProxyServer and RemoteServer application that are developed on .Net framework v3.5 using .Net Remoting "System.Runtime.Remoting". I am not using Microsoft.Samples.Security.SSPI &  Microsoft.Samples.Runtime.Remoting.Security directly. my code is based on "http://blogs.msdn.com/dotnetremoting/archive/2006/07/06/662599.aspx" Only change that I have done is put impersonate="true" in channel configuration of ProxyServer and RemoteServer, and of course changed the UPN and Port and IP address. The Client's credentials are successfully impersonated by ProxyServer, I can access the text file on ProxyServer on behalf of client. But when from ProxyServer I try to execute the method on RemoteServer it throws "the type initializer for 'system.runtime.remoting.identity' threw an exception." After looking at blog http://www.secnewsgroups.net/group/microsoft.public.dotnet.security/topic8251.aspx I did required changing under Local Security Settings -> Local Policies -> User Rights Assignments -> impersonate a client after authentication and Create Global Objects. I have added three domain user names in three machine under whose credentials corrosponding application is running. When i run three applications on their

namespace of type specified in the Imports 'AjaxControlToolkit doesnt contain any public member or

my website comes from a .net 20 config and am now on 4.0For this line: Imports AjaxControlToolkitI get this error: "namespace of type specified in the Imports 'AjaxControlToolkit"I could remove that line, were it not that it also says this line: Private _questions As CascadingDropDownNameValueerror: Type 'CascadingDropDownNameValue' is not defined.    My web.config has been upgraded, I have placed the latest ajaxcontroltoolkit.dll in my bin folder...what more can I do?

Need to fix this error : Type 'System.Web.UI.WebControls.CreateUserWizard' does not have a public


Hi all,

 i am usingVWD 2010 andwant to create a website supported under .net 3.5.

The deafault mater page has the loging pgaes already set up (.net 4.0) which is very good and helping to start.

But once i changed my project to run under .Net 3.5 , i could not have the account register webpage working and getting this error :

Parser Error Message: Type 'System.Web.UI.WebControls.CreateUserWizard' does not have a public property named 'LayoutTemplate'.


Any idea how can i fix this issue ??


Thanks ..




A first chance exception of type 'System.Runtime.InteropServices.COMException'


After calling a very simple WCF Service I bind the result an Observable Collection of Countries to WPF ComboBox, in second ComboBox of cities I displayed the filtered cities based on the selected country. It works fine the first time but when I select another country it takes lots of time to display, the Visual Studio 2010 output displays this like 50 times:

A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll

Intereting to point out that it only happens if I try to open the ComboBox and not if if navigate through code doing something like SelectedIndex=2 . It does not happen as well if instead of the ComboBox I use a ListBox or TreeView.

Some extra details.... the real exception detail is:

An event was unable to invoke any of the subscribers (Exception from HRESULT: 0x80040201)

Please help with this bug....

can't type a single key into login box Microsoft JScript runtime error:


I had to exclude several pages from my website to get it to run in vs 2008. When I finally got the home page to come up, I tried to type a character into the login box, and at the first character the probelm blows up:

Microsoft JScript runtime error: 'keyCode' is null or not an object

This is insanse. This is the page I'm on when it crashses. Does this have something to do with ajax?

<script type="text/javascript">
function onKeyPress (evt)
	var keycode;

	if (window.XMLHttpRequest)
		keycode = evt.keyCode;
		keycode = event.keyCode;



User Control Lib + ComponentResourceKey + StyleDictionary = Cannot Find Public Type

I'm trying to create a style resource dictionary file that can be used across all applications that use a user control defined in a user control lib. 

I added a resource dictionary called StyledUserControlLibDictionary.xaml to the StyledUserControlLib.
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 

how to chnage page content type at runtime in MVC?



 I am working in asp.net MVC & on the view has to show both json & xml content depending on some condition.

I have to change the content type of the page  at runtime ie,

if the condition for json is fulfilled then set page contenttype = "text/json"


if the condition for xml is fulfilled then set page contenttype = "text/xml".


I have tried setting default content type on view as


@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" ContentType="text/json"%>

& in controller c

Type 'System.Runtime.Remoting.ServerIdentity' is not marked as serializable.

Hi, I miss a trouble in my current workflow project, and it will cause my workflow instance terminate.  The exception as following. It says ServerIdentity  is not marked as serializable, but ServerIdentity is absolutely serializable.. anyone can help me? thanks a lot.

Code Snippet

Type 'System.Runtime.Remoting.ServerIdentity' in Assembly 'mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable. System.Runtime.Serialization.SerializationException: Type 'System.Runtime.Remoting.ServerIdentity' in Assembly 'mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable. at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type) at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context) at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) at System.Runtime.Serialization.Formatters.Binary.WriteObj

Using IPC only channel getting Unable to cast object of type 'System.Runtime.Remoting.Identity' to


I have a remoting application that is using delegates to preform callbacks between processes. I found that if I don't use a TCP channel at all and only initialize an IPC channel that the callback delegates start throwing the following error after about a minute has passed.

From what little I could find on Google it seems to be a Lifetime Service management issue but all the classes that the delegates belong to return null from InitializeLifetimeService which should give the object an infinite lifetime.

With the TCP channel initialized the issue doesn't happen, but I would like it to use the IPC channel if all of the processes are on the local box.


Type:        System.InvalidCastException
Message:    Unable to cast object of type 'System.Runtime.Remoting.Identity' to type 'System.Runtime.Remoting.ServerIdentity'.
Stack Trace:   
Server stack trace:
   at System.Runtime.Remoting.RemotingServices.GetServerTypeForUri(String URI)
   at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)


TreeSelector : playing with generics and type inference

create a generic way to define a selection starting from a tree of objects, the most simpler way as possible.

Let's start with the beginning...
Here is a very simple little interface defining a node of the tree, basically, a value and the references to the child nodes.

Create And Run Excel Macro At Runtime in C#

You've been tasked with writing a Windows Form application using the .NET Framework that interacts with Microsoft Excel. If you are new to working with Excel in .NET and are having trouble learning how to format certain cells or cell ranges, then this little tip will come in handy. Rather than scour the internet hoping to find the correct set of constants or method syntax for formatting your spreadsheet, use the built in tools in Excel to write the familiar VBA code for you. Then, you can paste the VBA code generated by Excel into the sample C# code below and run it dynamically at runtime.

UnTyped DataSets and Strongly Type DataSets

We all are use datasets as a means of carrier of data from one layer to another. Most of the time we are using weakly typed datasets. In this article I will explain the differences between weakly typed datasets and strongly type datasets

How to Localize Windows Forms and Change the Language at Runtime

Localization is the process of customizing your application to a particular language, culture or locale. Visual Studio provides support for localizing Windows Forms with much ease. In this article, we will see how to localize windows forms and give the user the ability to change to his preferred language at runtime.
When you run a localized application, the appearance is determined by two culture values. The UICulture property is used to specify which resource files will be loaded for the form. The Culture property, on the other hand, determines how strings such as dates, numerals, and currency amounts are formatted.
Let us see the steps required to create a localized form. You can then expand this example and adopt the same approach for the rest of the forms in your project

Gmail style multiple Sign-in type combo...is it possible in asp.net?


I am developing a multi-company application and want my users to give the functionality like the following to switch companies.


Is this possible? then how?

Please help


Content page control passes as argument to javascript function


Here is the content page:


<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="JavaDynamicCopyValue.aspx.cs" Inherits="JavaDynamicCopyValue" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 <script type="text/javascript" >
 function copyValue(input, output )
   ouput.value = input.value;
   return true;
 <asp:TextBox ID="txt1" runat="server" onchange="copyValue(this,document.getElementById('<%=txt2.ClientID%>'))"></asp:TextBox>
    <br />
    <br />
    <asp:TextBox ID="txt2" runat="server"></asp:TextBox>


I got a javascript run time error says output is undefined. if I view source of the page, the txt1 markup became:

<input name="ctl00$ContentPlaceHol

Type or namespace error.


A couple of days ago I started getting an unusual behavior when compiling Website projects. I have referenced class libraries added to my bin folder that are also correctely referenced in using statements in my aspx.cs code behind. When I compile, I get the 

Error 4 The type or namespace name 'CommonClassLibrary' could not be found (are you missing a using directive or an assembly reference?) C:\Dev\Fiscal_Portal\Implementation\FMS Portal Site_new\App_Code\BLL\DataTables.cs 1 7 C:\...\FMS Portal Site_new\

The type or namespace name 'CommonClassLibrary' could not be found (are you missing a using directive or an assembly reference?)

error message that would typically be received when the dll has not been added as a reference or added in a using statement.

I can eliminate the error by adding an


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend