问题
I am developping a windows phone 8.1 sdk
When I use vs 2013 update 3,the code works and i can run my demo.
but,yesterday,I update my vs 2013 to update 4,then throw a System.TypeLoadException
code details below:
var swapChainPanel = new SwapChainPanel();
Children.Add(swapChainPanel);
var res = new CXMapResource("", "");
cxEngine = new CXMapEngine(res);
Type CXMapResource is a windows runtime component type written by c++
and it is the first winrt type I load in my code
I set a break point before this line,it goes here,and then continue,then crash,
output:
A first chance exception of type 'System.TypeLoadException' occurred in Com.AMap.winmd
A first chance exception of type 'System.Exception' occurred in WP8.1Demo.ni.EXE
Update at 2014 11 18 16:08
System.TypeLoadException was unhandled by user code
HResult=-2146233054
Message=Requested Windows Runtime type 'WinRTDXMapLib.CXMapResource' is not registered.
Source=mscorlib
TypeName=WinRTDXMapLib.CXMapResource
StackTrace:
at System.StubHelpers.StubHelpers.GetWinRTFactoryObject(IntPtr pCPCMD)
at WinRTDXMapLib.CXMapResource..ctor(String EngineResourcePath, String ShaderResourcePath)
at Com.AMap.Maps.Core.AmapSharpEngine..ctor()
at Com.AMap.Api.Maps.AMapControl..ctor()
at WP8._1Demo.MainPage..ctor()
at WP8._1Demo.WP8_1Demo_XamlTypeInfo.XamlTypeInfoProvider.Activate_0_MainPage()
at WP8._1Demo.WP8_1Demo_XamlTypeInfo.XamlUserType.ActivateInstance()
InnerException: System.Runtime.InteropServices.COMException
HResult=-2147221164
Message=Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
ErrorCode=-2147221164
InnerException:
I let my college run the same code in vs 2013 update 2,and it works
please tell me what might result in this problem,give me some advice,Thanks!!
It works now!
VS 2013 UPDATE5 CTP2
回答1:
Unfortunately we have the same problem with Update 4, this is probaly caused by referencing a winmd (C++) component. We have the problem with the SmoothStreaming SDK for Windows 8.1.
We have reached to Microsoft but no answer yet.
A colleague solved this problem by reinstalling Windows and Visual Studio. Then he updated to Update 3. (Just removing the update 4 didn't work for him) I rather avoid this 'solution' but if there is no hotfix next week, I probaly have to do these steps.
Update
Microsoft answered my issue that they will fix this problem in Update 5. https://connect.microsoft.com/VisualStudio/Feedback/Details/1036072
回答2:
Discussion about this problem:
Vs update result in System.TypeLoadException,was it a bug of VS?
VS2013 Update 4: TypeLoad Exception when referencing a winmd (C++) component
Connect: TypeLoadException when referencing a winmd C++ component
I am able to reproduce this problem at Connect:
you can't create a constructor with param in c++ winrt component
*****you can see my demo project here(attachment):*****
Vs update result in System.TypeLoadException
来源:https://stackoverflow.com/questions/26965647/vs-update-result-in-system-typeloadexception