Answered by:
[UWP]Could not load assembley(badimageformatexception)

Question
-
Error to call any method of System.Threading , System.IO or System.ReflectionTypeExtensions that have been imported from nuguet in a universal app aplication, underneath have a exemple :
Call : private void Button_Click(object sender, RoutedEventArgs e) {
var thread = Thread.CurrentThread; }
Error: Could not load file or assembly 'System.Threading.Thread, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)
- Moved by Edward8520Microsoft contingent staff Friday, June 12, 2015 4:37 AM related with Universal Windows apps
- Edited by Rob Caplan [MSFT]Microsoft employee Friday, June 12, 2015 5:48 AM taggity
Wednesday, June 10, 2015 10:46 PM
Answers
-
Welcome to the Developing Universal Windows apps forum!
Please read the sticky posts, especially the Guide to posting: subject line tags and Known Issues for Windows 10 SDK and Tools
This is expected. Universal apps use the .NET for Windows Runtime apps, which does not include the classes and namespaces you mention. Instead you will use the Windows Runtime for similar (but generally async) behavior. For example, instead of using System.Threading.Thread you can spin up a worker thread with Windows.System.Threading.ThreadPool.
- Proposed as answer by Franklin ChenMicrosoft employee Tuesday, June 23, 2015 12:16 PM
- Marked as answer by Franklin ChenMicrosoft employee Wednesday, June 24, 2015 11:26 AM
Friday, June 12, 2015 5:47 AM
All replies
-
Hi Marcelo,
This forum is discussing client application development using Windows Forms controls and features, your issue is more related with Universal apps, I will move this thread to the more related forum.
Reference: http://social.msdn.microsoft.com/Forums/en-US/home?forum=wpdevelop
Thanks for your understanding.
Best Regards,
Edward
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.Friday, June 12, 2015 4:36 AM -
Welcome to the Developing Universal Windows apps forum!
Please read the sticky posts, especially the Guide to posting: subject line tags and Known Issues for Windows 10 SDK and Tools
This is expected. Universal apps use the .NET for Windows Runtime apps, which does not include the classes and namespaces you mention. Instead you will use the Windows Runtime for similar (but generally async) behavior. For example, instead of using System.Threading.Thread you can spin up a worker thread with Windows.System.Threading.ThreadPool.
- Proposed as answer by Franklin ChenMicrosoft employee Tuesday, June 23, 2015 12:16 PM
- Marked as answer by Franklin ChenMicrosoft employee Wednesday, June 24, 2015 11:26 AM
Friday, June 12, 2015 5:47 AM