c# - Excel Interop: Creating instance with Task.Run results in exception System.EntryPointNotFoundException -
here minimal example producing problem:
using system.runtime.interopservices; using system.threading.tasks; using excel = microsoft.office.interop.excel; class program { static void main(string[] args) { task.run(() => { excel.application app = new excel.application(); if (app != null) { app.quit(); marshal.finalreleasecomobject(app); app = null; } }); } }
this results in following exception:
the last part in japanese says "eventsetinformation" of dll advapi32.dll entry point cannot found
. i'm having difficulty understanding going on. why exception being thrown , trying tell me?
the exception in example produced vs 2013 on windows 7. in case, call eventsetinformation
not resolved function not found in advapi32.dll
. then, tested same code visual studio 2015 ctp , ran completion without exceptions. led me believe version conflict.
also, according here , msdn, eventsetinformation
added advapi32.dll in windows 8. why not found when ran code vs 2013. therefore, run code snippet, needed newer version of advapi32.dll included later visual studio versions (or windows 8).
update
according https://github.com/dotnet/coreclr/issues/974
note os group has assured win7 patched include api (within months), exception not happen @ point
so, advapi32.dll on windows 7 updated include eventsetinformation
time in future.