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


Top 5 Contributors of the Month
MarieAdela
Imran Ghani
Post New Web Links

"Cannot create unknown type" error when invoking a dynamic activity

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :Windows Application
 
I am trying to use WF 4 to create business rule policy activities that I can store as XAML files and execute dynamically so the rules can be changed without recompiling.  I have created an ExecuteActivityFromXAML activity that takes the path to the XAML file and a dictionary of inputs and loads a dynamic activity from the XAML and then uses workflow invoker to invoke the activity passing in the input parameter dictionary.  In another assembly, I have created rule executor activites that wrap each of the xaml rule activities and build the input parameter dictionary and specify the XAML file path.  For example, I have a parent-child object with three rule activities stored as xaml files on disk (they are in my project with a build action of "None") -  ValidateParent, ValidateChildren, and ValidateChild.  I then have 3 activities compiled into my assembly that build the input parameter collection and use the common ExecuteActivityFromXAML activity to invoke the 3 XAML files - ExecuteValidateParent, ExecuteValidateChildren, ExecuteValidateChild.  The ValidateChildren activity is supposed to validate rules on the collection and then loop through each child object and call ValidateChild.  I can call ExecuteValidateParent with no error if it does not reference the other activities, but when I try callt he ExecuteVal


View Complete Post


More Related Resource Links

"Type ASP.x is not defined" error for dynamic user control when publishing updateable

  

I have a user control (ContainerCtrl) which programmatically instantiates another user control (SimpleCtrl) in OnLoad. It builds and runs fine, but when I publish it I get the error "error BC30002: Type 'ASP.SimpleCtrl' is not defined." (If I publish without the "updateable" option there's no error, but I need the site to be updateable.)

I assume this has to do with the particulars of how the assembly(ies) are built for the different compiler options. My question is, how can I get it to work properly for "updateable" publishing?

VS 2008 / .NET 3.5 sp1

The code follows (web.config is the default from Visual Studio).

Many thanks, Dave

SimpleCtrl.aspx------------------------------

<%@ Control Language="VB" ClassName="SimpleCtrl" CodeFile="SimpleCtrl.ascx.vb" Inherits="_SimpleCtrl" %>

<div>
    Simple control
</div>

SimpleCtrl.aspx.vb------------------------------

Partial Class _SimpleCtrl
    Inherits UserControl

    'Nothing to see here.

End Class

ContainerCtrl.aspx------------------------------

<%@ Control Language="VB" CodeFile="ContainerCtrl.ascx.vb" Inherits="_ContainerCtrl"

Using Dynamic Property inside Html Helper with Razor fires an error

  

Hello,

I have the following with Razor:

@Html.GoogleAjax(View.GoogleAjaxKey, new String[,] { { "jquery", "1.4.2" } })

And the I get a strange error:

  'System.Web.Mvc.HtmlHelper<object>' has no applicable method named 'GoogleAjax' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.

What is strange is that it works fine using:

@Html.GoogleAjax("123", new String[,] { { "jquery", "1.4.2" } })

I tried the following code line:


@View.GoogleAjaxKey

And the key is displayed just fine so the problem is how I use the value of @View.GoogleAjaxKey into Html.GoogleAjax.


Do I need to change something on my Html Helper? Here it is:


    public static MvcHtmlString GoogleAjax(this HtmlHelper helper, String key, String[,] libraries) {

      

Dynamic workflow with While activity

  
We have a very strange problem with WWF 3.5. All our workflows are loaded dynamically, i.e we have different  assemblies containing libraries of the workflows. We starting each workflow by specifying path to assembly and name of the workflow class in the assembly:     Assembly  workflowAssembly = Assembly.LoadFrom(path);     Type  workflowType = workflowAssembly.GetType(name ); We are creating work flow instance as following and execute starts:     WorkflowInstance instance =     workflowRuntime.CreateWorkflow(workflowType, dictParameters);      instance.Start(); Everything works just fine till it hits the While activity. Here workflow is terminated because of the exceptions. Interesting thing is that exceptions here are different depending on what work flow is doing. In case when loop execute sequence activity containing just code activity which increasing some index by 1 each iteration (what could be simpler!) exception is, providing as part of the WorkflowTerminatedEventArgs e: Exception    {"Error binding to target method."}    System.Exception {System.Runtime.Serialization.SerializationException}   When our assembly containing workflows has name  "TestLibPghWWF" and inside While activity, the sequence activity contains real,&

Error while invoking wcf service and running its methods

  
Failed to invoke the service. Possible causes: The service is offline or inaccessible; the client-side configuration does not match the proxy; the existing proxy is invalid. Refer to the stack trace for more detail. You can try to recover by starting a new proxy, restoring to default configuration, or refreshing the service.    I am using a wcf service with some methods in it called by some layers wherein i am putting all my business logic.While invoking the service from wcftestclient  and when running few methods i am getting this error . I am getting output for some methods in the same service but for some other methods i am getting this error . I am using LINQ in the methods.    My solution has number of projects .For running the service ,i am right clicking on the project and viewing in the browser as i cannot build whole solution as i have few errors in some unit test projects.       As i am getting output for some methods ,this is definetly not about starting the service .  

Invoking custom WCF service throws an Impersonation error from SQL

  
I've written a custom WCF service and hosted it in SharePoint. Accessing the MEX endpoint works fine. However, when I try to invoke the WCF service from my client code, I get the following error: 'A transport-level error has occurred when sending the request to the server. (provider: Shared Memory Provider, error: 0 - Either a required impersonation level was not provided, or the provided impersonation level is invalid.)'. This exception gets thrown even before my WCF service gets invoked. Attaching a debugger, I see the following stack trace associated with the exception: 00000000`0c2dd7d0 000007fe`e7589b95 System_Data_ni!System.Data.SqlClient.SqlConnection.OnError(System.Data.SqlClient.SqlException, Boolean)+0xd4 00000000`0c2dd810 000007fe`e7b7cd3b System_Data_ni!System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(System.Data.SqlClient.TdsParserStateObject)+0xf5 00000000`0c2dd870 000007fe`e758c4ee System_Data_ni!System.Data.SqlClient.TdsParserStateObject.WriteSni()+0x5f77ab 00000000`0c2dd8f0 000007fe`e758bf29 System_Data_ni!System.Data.SqlClient.TdsParserStateObject.ExecuteFlush()+0xae 00000000`0c2dd950 000007fe`e757a1c7 System_Data_ni!System.Data.SqlClient.TdsParser.TdsExecuteRPC(System.Data.SqlClient._SqlRPC[], Int32, Boolean, System.Data.Sql.SqlNotificationRequest, System.Data.SqlClient.TdsParserStateObject, Boolean)+0x1189 00000000`0c2ddbf

Help - error invoking WCF on Apache Web Server

  

I'm attempting to host a WCF service and Silverlight client on Apache Web Server, and I'm running into some issues. The Silverlight client is a simple web page that calls a WCF service, but I'm having problems:

  • I can successfully access my .svc file through a browser locally using localhost, but if I try to use the system IP address locally instead, I get an error of  No protocol binding matches the given address 'http://192.168.100.75/WCFDuplex/PubSubService.svc'. Protocol bindings are configured at the Site level in IIS or WAS configuration.
  • If in the codebehind of my Silverlight page I hardcode the URL to the WCF service to use localhost and I locally access the Silverlight web page using localhost in the URL, the Silverlight page is able to successfully interact with the WCF web service. This is good, so nothing to fix here. However, if I access the Silverlight web page locally using the IP address in the URL and in the codebehind of my Silverlight page I hardcode the URL to the WCF service to use localhost, I get a NotFound error when the Silverlight page attempts to interact with the web service.

Are there any specific steps to make a WCF service hostable on Apache Web Server? Should I be able to invoke a WCF web service from Silverlight on an Apache Web Server? I've setup both clientaccesspolicy.

Access is denied error thrown in "Setup Secure Session" activity

  

Hello,
Could someone help me with the following issue, please?

System setup:
- Windows 2008 R2 server hosting both MVC2 web application and WCF service for it;
- users connect to the web application which gets all data from the WCF services;
- WCF services are resused by several other applications (WinForms based) which work fine and have never experienced any security related problems;
- MVC2 uses impersonation (<identity impersonate="true"/>) to connect to WCF services, so we have single security boundary for both web and winforms clients (which are out of scope of the problem);
- both MVC2 web application and WCF services share the same ASP.NET v4.0 DefaultAppPool application pool, running under NetworkService identity;
- all users, user PCs and servers belong to the same AD domain, which is a part of global corporate tree;
- all unhandled exceptions are automatically caught by the web application and forwarded to application developers' e-mail box;
- WCF binding setup in web application:

<wsHttpBinding>
    <binding name="WSHttpBinding_BifrostServices" closeTimeout="00:10:00"
     openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"

Invoking custom WCF service throws an Impersonation error from SQL

  

I've written a custom WCF service and hosted it in SharePoint. Accessing the MEX endpoint works fine. However, when I try to invoke the WCF service from my client code, I get the following error:

'A transport-level error has occurred when sending the request to the server. (provider: Shared Memory Provider, error: 0 - Either a required impersonation level was not provided, or the provided impersonation level is invalid.)'.

This exception gets thrown even before my WCF service gets invoked. Attaching a debugger, I see the following stack trace associated with the exception:

00000000`0c2dd7d0 000007fe`e7589b95 System_Data_ni!System.Data.SqlClient.SqlConnection.OnError(System.Data.SqlClient.SqlException, Boolean)+0xd4
00000000`0c2dd810 000007fe`e7b7cd3b System_Data_ni!System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(System.Data.SqlClient.TdsParserStateObject)+0xf5
00000000`0c2dd870 000007fe`e758c4ee System_Data_ni!System.Data.SqlClient.TdsParserStateObject.WriteSni()+0x5f77ab
00000000`0c2dd8f0 000007fe`e758bf29 System_Data_ni!System.Data.SqlClient.TdsParserStateObject.ExecuteFlush()+0xae
00000000`0c2dd950 000007fe`e757a1c7 System_Data_ni!System.Data.SqlClient.TdsParser.TdsExecuteRPC(System.Data.SqlClient._SqlRPC[], Int32, Boolean, System.Data.Sql.SqlNotificationRequest, System.Data.SqlClient.TdsParserState

Dynamic Activity calling CLR Activity fails when Invoked?

  

MyActivity.xaml has a child activity, a CLR AsyncCodeActivity, SendMail.cs, dragged and dropped onto the 'root' activity which is a FlowChart.   SendMail.cs is in the same directory as MyActivity.xaml which is loaded dynamically like so:

    dynamicallyLoadedActivity = ActivityXamlServices.Load("("..\..\..\MyActivities\MyActivity.xaml");

At runtime, when WorkflowInvoker.Invoke(dynamicallyLoadedActivity ) is called, this exception is thrown:

    XamlObjectWriterException: Cannot create unknown type {"Cannot create unknown type '{clr-namespace:MyApp.MyActivities}SendEmail'."}

The imports on MyActivty.xaml include "MyApp"  xmlns:local="clr-namespace:MyApp.MyActivities"  and the xaml: <local:SendEmail .... looks OK.

Here is the top of the stack trace:

System.Xaml.XamlObjectWriterException was unhandled
  Message=Cannot create unknown type '{clr-namespace:MyApp.MyActivities}SendEmail'.
  Source=System.Xaml
  LineNumber=0
  LinePosition=0
  StackTrace:
       at System.Xaml.XamlObjectWriter.WriteStartObject(XamlType xamlType)
       at System.Xaml.XamlWriter.WriteNode(XamlReader reader)
  

Outlook Social Connector and Activity Feed error

  
Hi,

I am testing out the Outlook Social Connector. The Facebook and LinkedIn providers work great, however when I try the MySite provider
I receive an XML validation error.

The connection appears to be successful however when I click on "Finish" in the dialog I get the error message. This is the standard
SharePoint activity Feed

Using Fiddler, I see:

http://ctndev2/my/_vti_bin/Authentication.asmx
http://ctndev2/my/_vti_bin/Authentication.asmx
http://ctndev2/my/_vti_bin/UserProfileService.asmx
http://ctndev2/_layouts/ActivityFeed.aspx?feedtype=ATOM1.0&consolidated=true&earliest=2010-10-5%208:44:2

The error is presented after the UserProfileService call. After clicking Ok, I see the final request.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="

dynamic snapshot error

  

Hi ALL,

   I am getting the following error when merge agent runns.

·          The merge process was unable to deliver the snapshot to the Subscriber. If using Web synchronization, the merge process may have been unable to create or write to the message file. When troubleshooting, restart the synchronization with verbose history logging and specify an output file to which to write. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147201001)
Get help: http://help/MSSQL_REPL-2147201001

·          The partitioned snapshot available for this Subscriber is outdated. To initialize this Subscriber, you must generate a new partitioned snapshot or enable the Merge Agent to automatically de

Dynamic routing problem when invoking site from remote host.

  

Hello,


I have problem described under following link: mvcrouting

Can someone give me some clues how to deal with that ?

Regards


Workflow Constructor Error: Could not create activity of type '{Workflow}'

  
If I attempt to new-up a custom class in my Workflow constructor:

_workflowInfo =  
                new WorkflowInfo(workflowProperties.OriginatorUser, workflowProperties.Item,  
                    workflowProperties.TaskList); 

... I receive the following error:

Error 1 Could not create activity of type '{Workflow}'. System.ArgumentNullException: Value cannot be null.
Parameter name: uriString
   at System.Uri..ctor(String uriString)
   at Microsoft.Shar

EnsurePanelFix Javascript is Breaking Dynamic Validator Error Messages

  

I've created a user control with input fields and validators. It also has an update panel for adding adding an additional field. I'm loading this control within a web part and I have the EnsurePanelFix method running before I add the control. If I test the regular expression validators, I do not get an error message until I hit submit. However, if I remove this portion of the EnsurePanelFix method

RestoreToOriginalFormAction = function()
   {
    if (_spOriginalFormAction != null)
    {
     RestoreToOriginalFormActionCore();
     document.forms[0]._initialAction = 
     document.forms[0].action;
    }
   }";

Then the validator error messages work as they should and validate on the fly without needing to submit the form.

Any ideas?


error at sendMail activity

  

Hello,

I have a VisualStudio 2008 State Machine Workflow with three states. In my last State I want to send an E-Mail with a sendMail activity. The steps: code activity -> sendMail activity -> setState activity. Without the Email-Activity the WF works finde. When I add the sendMail activity, the last state ends in "In progress " and not in "Complete" and no Email is sent. The WF throws an " Error Occurred ".

I would be thankful of any advices!

 

 

Here the used code:

 

private void sendEmail_ExecuteCode( object

Error: Workflow Custom Activity

  

Hi

I have a custom activity, which is available under Designer Actions.
I can see and set parameters. However on the Finish step, I encounter following error:

Errors were found when compiling the workflow. The workflow files were saved but cannot be run.

On clicking Advanced, I get this:
(14, 47) The type name 'SendMailWithAttachmentActivity' does not exist in the type 'SendMailWithAttachmentActivity.SendMailWithAttachmentActivity')

Here is Action tag:

   <Action Name="Send Attachments"
      ClassName="SendMailWithAttachmentActivity.SendMailWithAttachmentActivity"
      Assembly="SendMailWithAttachmentActivity, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff5f77ebcbc6469d"
      AppliesTo="all"
      Category="Email Actions">
      <RuleDesigner Sentence="Send Attachs to %1 besides %2">
        <FieldBind Field="EmailID" Text="people field" Id="1" DesignerType="TextArea"/>
        <FieldBind Field="Junk" Text="enter jun

Error when adding one instance of activity multiple time into Sequence activity

  

 

Hi all, 

I encounter this error when I tried to add same Writeline instance into two different Sequence activities as shown in the code below:

 

      ActivityBuilder ab = XamlServices.Load(ActivityXamlServices.CreateBuilderReader(new XamlXmlReader(new StringReader(_designer.Text)))) as ActivityBuilder;
      //inspecting ab ...
      Console.WriteLine("There are {0} arguments in the activity builder.", ab.Properties.Count);
      _sequenceListModel.Clear();
      
      
      //ProcessActivity(ab.Implementation, "");
      //ProcessActivity2(ab.Implementation);
      
      //test code to add two same instances of activities in a sequence and execute them 
      if(ab.Implementation is Sequence)
      {
        Sequence seq = ab.Implementation as Sequence;
        
Categories: 
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