# Why is there exception runtime

**URL:** <https://tech-community.robotics.abb.com/t/why-is-there-exception-runtime/5080>\
**Category:** Developer Tools\
**Created:** [September 13, 2012, 5:30am UTC](https://tech-community.robotics.abb.com/t/why-is-there-exception-runtime/5080 "2012-09-13T05:30:51Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![zijiang](https://avatars.discourse-cdn.com/v4/letter/z/8edcca/32.png) [@zijiang](https://tech-community.robotics.abb.com/u/zijiang)\
**Post date:** [September 13, 2012, 5:30am UTC](https://tech-community.robotics.abb.com/t/why-is-there-exception-runtime/5080/1 "2012-09-13T05:30:51Z")

</div>

System.TypeInitializationException was unhandled  
Message=“The type initializer for ‘ABB.Robotics.Controllers.Internal.NetworkScanner’ threw an exception.”  
Source=“ABB.Robotics.Controllers”  
TypeName=“ABB.Robotics.Controllers.Internal.NetworkScanner”  
StackTrace:  
at ABB.Robotics.Controllers.Internal.NetworkScanner.get\_Instance()  
at ABB.Robotics.Controllers.Discovery.NetworkScanner..ctor()  
at ControllerAPI.Create.DynamicCreation() in C:abbpc interfaceControllerAPIControllerAPICreateControllerCreate.cs:line 64  
at ControllerAPI.Create.Main(String args) in C:abbpc interfaceControllerAPIControllerAPICreateControllerCreate.cs:line 55  
at System.AppDomain.\_nExecuteAssembly(Assembly assembly, String args)  
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()  
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)  
at System.Threading.ThreadHelper.ThreadStart()  
InnerException: System.BadImageFormatException  
Message=“Could not load file or assembly ‘ABB.Robotics.Adapters.IRC5, Version=5.14.3070.3, Culture=neutral, PublicKeyToken=1da709b7d1f14b7b’ or one of its dependencies. An attempt was made to load a program with an incorrect format.”  
Source=“ABB.Robotics.Controllers”  
FileName=“ABB.Robotics.Adapters.IRC5, Version=5.14.3070.3, Culture=neutral, PublicKeyToken=1da709b7d1f14b7b”  
FusionLog="=== Pre-bind state information === LOG: User = ASIAPACIFIC\CNZIQI LOG: DisplayName = ABB.Robotics.Adapters.IRC5, Version=5.14.3070.3, Culture=neutral, PublicKeyToken=1da709b7d1f14b7b (Fully-specified) LOG: Appbase = file:///C:/abb/pc interface/ControllerAPI/ControllerAPI/CreateController/bin/Debug/ LOG: Initial PrivatePath = NULL Calling assembly : ABB.Robotics.Controllers, Version=5.14.3070.0, Culture=neutral, PublicKeyToken=1da709b7d1f14b7b. === LOG: This bind starts in default load context. LOG: No application configuration file found. LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config. LOG: Post-policy reference: ABB.Robotics.Adapters.IRC5, Version=5.14.3070.3, Culture=neutral, PublicKeyToken=1da709b7d1f14b7b LOG: Attempting download of new URL file:///C:/abb/pc interface/ControllerAPI/ControllerAPI/CreateController/bin/Debug/ABB.Robotics.Adapters.IRC5.DLL. ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated. "  
StackTrace:  
at ABB.Robotics.Controllers.Internal.NetworkScanner..ctor()  
at ABB.Robotics.Controllers.Internal.NetworkScanner..cctor()  
InnerException:

---

<div class="post-metadata">

**Author:** ![John\_Wiberg](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/john_wiberg/32/1485_2.png) [@John\_Wiberg](https://tech-community.robotics.abb.com/u/John_Wiberg)\
**Post date:** [September 13, 2012, 7:42am UTC](https://tech-community.robotics.abb.com/t/why-is-there-exception-runtime/5080/2 "2012-09-13T07:42:19Z")

</div>

We really need more info than just the stack.

Is this PCSDK? If not then which SDK are you using?

What command is executing when you get this error?

Is this during developement or a deployed application?

etc. The more surrounding info the more we will be able to help you.

Now, just by going on the error message “Could not load file or assembly 'ABB.Robotics.Adapters.IRC5, Version=5.14.3070.3” I’d ask you to check out which version of RobotWare the controller has, and which version do you have installed with the APP.

---

<div class="post-metadata">

**Author:** ![zijiang](https://avatars.discourse-cdn.com/v4/letter/z/8edcca/32.png) [@zijiang](https://tech-community.robotics.abb.com/u/zijiang)\
**Post date:** [September 13, 2012, 8:32am UTC](https://tech-community.robotics.abb.com/t/why-is-there-exception-runtime/5080/3 "2012-09-13T08:32:26Z")

</div>

[webwiz/2128/CreateController.zip](http://forums.robotstudio.com/webwiz/2128/CreateController.zip)

pc sdk 5.14

![](http://forums.robotstudio.com/webwiz/2128/prob.png)

---

<div class="post-metadata">

**Author:** ![zijiang](https://avatars.discourse-cdn.com/v4/letter/z/8edcca/32.png) [@zijiang](https://tech-community.robotics.abb.com/u/zijiang)\
**Post date:** [September 13, 2012, 8:35am UTC](https://tech-community.robotics.abb.com/t/why-is-there-exception-runtime/5080/4 "2012-09-13T08:35:20Z")

</div>

Robotware version :RW5.14\_03.01.3071

---

<div class="post-metadata">

**Author:** ![CaptainAwesome](https://avatars.discourse-cdn.com/v4/letter/c/e19adc/32.png) [@CaptainAwesome](https://tech-community.robotics.abb.com/u/CaptainAwesome)\
**Post date:** [September 21, 2012, 12:12pm UTC](https://tech-community.robotics.abb.com/t/why-is-there-exception-runtime/5080/5 "2012-09-21T12:12:30Z")

</div>

I have the very same problem, using the 5.13 version of the dlls. The funny thing is that it works on my Win7 32bit machine, but fails on the WinXP machine. I’m very thrilled to find a solution to this problem.

EDIT: Oh dear. I had only installed the SDK. Installing the whole RobotStudio fixed the issue for me!

---

<div class="post-metadata">

**Author:** ![Niklas\_Skoglund](https://avatars.discourse-cdn.com/v4/letter/n/5fc32e/32.png) [@Niklas\_Skoglund](https://tech-community.robotics.abb.com/u/Niklas_Skoglund)\
**Post date:** [October 11, 2012, 10:30pm UTC](https://tech-community.robotics.abb.com/t/why-is-there-exception-runtime/5080/6 "2012-10-11T22:30:51Z")

</div>

Make sure that you are building a 32-bit executable, by specifying x86 as the platform target in the VS project settings.

If AnyCPU is specified, and you execute the application on a 64bit OS, a 64bit process will get started. Parts of PC SDK are implemented in COM (native code) which is not built for 64bit. The inner exception of the exception in your stack trace is a bad image format exception caused by the fact that a 32 bit assembly is attempted to get loaded into a 64 bit process.

On a 32 bit OS there are only 32 bit processes and this mismatch can not happen.

Please note that a 64 bit OS can run a 32 bit process, but not the opposite. That is why all your good old applications that you had on your 32 bit machine continues to function when you double your bits and go 64 :bulb:?

---

<div class="post-metadata">

**Author:** ![andyong](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@andyong](https://tech-community.robotics.abb.com/u/andyong)\
**Post date:** [August 8, 2013, 1:04pm UTC](https://tech-community.robotics.abb.com/t/why-is-there-exception-runtime/5080/7 "2013-08-08T13:04:02Z")

</div>

i have the same problem .i solved it by two steps:  
firstly,robotstudio must be installed.secondly,you must specify x86 as the platform target in the VS project settings.

---

<div class="post-metadata">

**Author:** ![andyong](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@andyong](https://tech-community.robotics.abb.com/u/andyong)\
**Post date:** [August 8, 2013, 1:04pm UTC](https://tech-community.robotics.abb.com/t/why-is-there-exception-runtime/5080/8 "2013-08-08T13:04:02Z")

</div>

> [@Niklas Skoglund](#):
>
> Make sure that you are building a 32-bit executable, by specifying x86 as the platform target in the VS project settings.
> 
> If AnyCPU is specified, and you execute the application on a 64bit OS, a 64bit process will get started. Parts of PC SDK are implemented in COM (native code) which is not built for 64bit. The inner exception of the exception in your stack trace is a bad image format exception caused by the fact that a 32 bit assembly is attempted to get loaded into a 64 bit process.
> 
> On a 32 bit OS there are only 32 bit processes and this mismatch can not happen.
> 
> Please note that a 64 bit OS can run a 32 bit process, but not the opposite. That is why all your good old applications that you had on your 32 bit machine continues to function when you double your bits and go 64 :bulb:?

I have the same problem as zijiang.And I have specified x86 as the platform target in the VS project settings,but the problem still exities .

---

<div class="post-metadata">

**Author:** ![baijun](https://avatars.discourse-cdn.com/v4/letter/b/e0b2c6/32.png) [@baijun](https://tech-community.robotics.abb.com/u/baijun)\
**Post date:** [September 7, 2016, 9:44am UTC](https://tech-community.robotics.abb.com/t/why-is-there-exception-runtime/5080/9 "2016-09-07T09:44:41Z")

</div>

> [@andyong](#):
>
> i have the same problem .i solved it by two steps:  
> firstly,robotstudio must be installed.secondly,you must specify x86 as the platform target in the VS project settings.

Hi andyong ,I have the same problem as zijiang.I do as you approach, the problem remains unresolved.

---

<div class="post-metadata">

**Author:** ![baijun](https://avatars.discourse-cdn.com/v4/letter/b/e0b2c6/32.png) [@baijun](https://tech-community.robotics.abb.com/u/baijun)\
**Post date:** [September 7, 2016, 9:46am UTC](https://tech-community.robotics.abb.com/t/why-is-there-exception-runtime/5080/10 "2016-09-07T09:46:44Z")

</div>

> [@](#):
>
> Make sure that you are building a 32-bit executable, by specifying x86 as the platform target in the VS project settings.
> 
> If AnyCPU is specified, and you execute the application on a 64bit OS, a 64bit process will get started. Parts of PC SDK are implemented in COM (native code) which is not built for 64bit. The inner exception of the exception in your stack trace is a bad image format exception caused by the fact that a 32 bit assembly is attempted to get loaded into a 64 bit process.
> 
> On a 32 bit OS there are only 32 bit processes and this mismatch can not happen.
> 
> Please note that a 64 bit OS can run a 32 bit process, but not the opposite. That is why all your good old applications that you had on your 32 bit machine continues to function when you double your bits and go 64 ?

Hi Niklas Skoglund ,thank you for your attention.I am new in using PC SDK,failed in initialization of NetworkScanner class ,my project is set to X86, ABB.Robotics.Controllers.PC.dll version 6.3.7016.2009, the same as Robot Communication Runtime. May I ask you, what is the problem and what is the solution, thank you very much
