I have a project which uses workflow and dynamic assemblies. When the project is being debuged in Visual Studio 2005 the "A first chance exception of type 'System.NotSupportedException' occurred in mscorlib.dll" is thrown.
Call stack:
> mscorlib.dll!System.Reflection.Emit.AssemblyBuilder.Location.get() + 0x37 bytes
System.Workflow.Runtime.dll!System.Workflow.Runtime.DebugEngine.DebugController.AttachToConduit(System.Uri url) + 0x373 bytes
[Native to Managed Transition]
[Managed to Native Transition]
mscorlib.dll!System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(System.RuntimeMethodHandle md, object[] args, object server, int methodPtr, bool fExecuteInContext, out object[] outArgs) + 0x20 bytes
mscorlib.dll!System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage msg, int methodPtr, bool fExecuteInContext) + 0x38b bytes
mscorlib.dll!System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage msg) + 0x9 bytes
mscorlib.dll!System.Runtime.Remoting.Messaging.ServerObjectTerminatorSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage reqMsg) + 0xcd bytes
mscorlib.dll!System.Runtime.Remoting.Messaging.ServerContextTerminatorSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage reqMsg) + 0x15a bytes
mscorlib.dll!System.Runtime.Remoting.Channels.CrossContextChannel.SyncProcessMessageCallback(object[] args) + 0xfa bytes
mscorlib.dll!System.Runtime.Remoting.Channels.ChannelServices.DispatchMessage(System.Runtime.Remoting.Channels.IServerChannelSinkStack sinkStack, System.Runtime.Remoting.Messaging.IMessage msg = {System.Runtime.Remoting.Messaging.MethodCall}, out System.Runtime.Remoting.Messaging.IMessage replyMsg = null) + 0x1c1 bytes
mscorlib.dll!System.Runtime.Remoting.Channels.DispatchChannelSink.ProcessMessage(System.Runtime.Remoting.Channels.IServerChannelSinkStack sinkStack, System.Runtime.Remoting.Messaging.IMessage requestMsg, System.Runtime.Remoting.Channels.ITransportHeaders requestHeaders, System.IO.Stream requestStream, out System.Runtime.Remoting.Messaging.IMessage responseMsg, out System.Runtime.Remoting.Channels.ITransportHeaders responseHeaders, out System.IO.Stream responseStream) + 0x32 bytes
System.Runtime.Remoting.dll!System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(System.Runtime.Remoting.Channels.IServerChannelSinkStack sinkStack = {System.Runtime.Remoting.Channels.ServerChannelSinkStack}, System.Runtime.Remoting.Messaging.IMessage requestMsg = {System.Runtime.Remoting.Messaging.MethodCall}, System.Runtime.Remoting.Channels.ITransportHeaders requestHeaders, System.IO.Stream requestStream, out System.Runtime.Remoting.Messaging.IMessage responseMsg = null, out System.Runtime.Remoting.Channels.ITransportHeaders responseHeaders = null, out System.IO.Stream responseStream = null) + 0x3e3 bytes
System.Runtime.Remoting.dll!System.Runtime.Remoting.Channels.Ipc.IpcServerTransportSink.ServiceRequest(object state) + 0x1fe bytes
System.Runtime.Remoting.dll!System.Runtime.Remoting.Channels.SocketHandler.ProcessRequestNow() + 0x26 bytes
System.Runtime.Remoting.dll!System.Runtime.Remoting.Channels.RequestQueue.ProcessNextRequest(System.Runtime.Remoting.Channels.SocketHandler sh) + 0x16 bytes
System.Runtime.Remoting.dll!System.Runtime.Remoting.Channels.SocketHandler.BeginReadMessageCallback(System.IAsyncResult ar) + 0xa7 bytes
System.Runtime.Remoting.dll!System.Runtime.Remoting.Channels.Ipc.IpcPort.AsyncFSCallback(uint errorCode, uint numBytes, System.Threading.NativeOverlapped* pOverlapped) + 0x4e bytes
mscorlib.dll!System.Threading._IOCompletionCallback.PerformIOCompletionCallback(uint errorCode, uint numBytes, System.Threading.NativeOverlapped* pOVERLAP) + 0x68 bytes
Outside VS2005 all works normally.
How I can solve this problem
Thanks, Nata

Problem with dynamic assemblies usage
EdZilla
Hi, Sonali!
1. Steps for reproduce:
- Create Sequential Workflow Console Application
- In Main function before creating WorkflowRuntime (code created by wizard) insert:
AppDomain
myAppDomain = Thread.GetDomain(); AssemblyName myAsmName = new AssemblyName();myAsmName.Name =
"MyAssembly"; AssemblyBuilder myAsmBuilder = myAppDomain.DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess.Run); ModuleBuilder myModuleBuilder = myAsmBuilder.DefineDynamicModule("MyModule1");- Check on "Debug->Exceptions->Common Language Runtime Exceptions"
- Press F5
2. I'm debugging using F5
3. I have created Sequential Workflow Console Application. Workflow and host are in the same application.
4,5. Debug engine starts automaticaly.
6. I'm use default debugging options:
"Debugging->Workflow->Enable native code debugging" is turned off,
"Debugging->Just-In-Time->Native" is turned on,
"Debugging->Just-In-Time->Workflow" is turned off,
"Debugging->Native->Load DLL exports" is turned off,
"Debugging->Native->Enable RPC debugging" is turned off
7. -MS VS 2005 Proffesional Edition Version 8.0.50727.42 (RTM.50727.4200 )
- MS .NET Framework Version 2.0.50727
- WF beta 2 (Version of assemlies 3.0.0.0)
Thanks,
Nata
david_wants
Hi Nata,
Thanks for the repro steps. We were able to repro the problem and we are investigating this issue. In beta2 there is no functionality to disable the debugger but we have added it in our RTM release version.
Thanks,
Sonali
iamreal2
Hi Nata,
Can you give us some more details about your scenario
1. What assemblies are dynamic and how are you using them in the workflow
2. Are you debugging the workflow using F5 or Attach to process
3. Is workflow and host separate or in the same application
4. If you are debugging using Attach to process, is debug engine selection automatic or manual
5. If manual, are you selecting any other debug engines along with the Workflow
6. Have you enabled Native code debugging
7. What is the version of VS and WF
Thanks,
Sonali