因此,我尝试在Visual Studio 2015中安装Visual Studio扩展程序,但在尝试时遇到此安装错误:
System.NullReferenceException:未将对象引用设置为实例 对象
奇怪的是,我可以在调试时在实验实例中运行扩展。
这是在安装日志中:
Beginning to install extension to Microsoft Visual Studio Professional 2015...
Install Error : System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.CheckForValidDotNetFramework(IExtension extension)
at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.CheckForInstallBlockers(InstallableExtensionImpl extension, IInstalledExtensionList modifiedInstalledExtensionsList, Boolean isNestedExtension, Boolean& olderVersionInstalled)
at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.InstallInternal(InstallableExtensionImpl extension, Boolean perMachine, Boolean isNestedExtension, IDictionary`2 extensionsInstalledSoFar, List`1 extensionsUninstalledSoFar, IInstalledExtensionList modifiedInstalledExtensionsList, AsyncOperation asyncOp, UInt64 totalBytesToWrite, UInt64& totalBytesWritten, Boolean enforceCertificateCheckForUpgrade)
at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.BeginInstall(IInstallableExtension installableExtension, Boolean perMachine, AsyncOperation asyncOp, Boolean enforceCertificateCheckForUpgrade)
at Microsoft.VisualStudio.ExtensionManager.ExtensionManagerService.InstallWorker(IInstallableExtension extension, Boolean perMachine, AsyncOperation asyncOp, Boolean enforceCertificateCheckForUpgrade)
我已经尝试过的事情:
devenv /safemode
)devenv /resetsettings
请帮忙。
答案 0 :(得分:0)
好了所以现在我检查了ExtensionManager.Implementation,并且从CheckForValidDotNetFramework方法我发现没有为扩展设置.NET Framework的Version范围。我可以在source.extension.vsixmanifest
下Dependencies
下的[4.6.1]
中设置它,然后在将.NET框架更改为所有项目的Version range
后,在@Service
@PropertySource(value = "classpath:subscriberEventMapping.properties")
public abstract class AbstractEventHandler implements IEventHandler {
private String eventIdPattern;
@Autowired
Environment env;
@Autowired(required = true)
public void configureEventIdPattern() {
String simpleClassName = this.getClass().getSimpleName();
String resolvedEventIdPattern = env.getProperty(
simpleClassName.substring(0,1).toLowerCase() +
simpleClassName.substring(1, simpleClassName.length()));
this.eventIdPattern = resolvedEventIdPattern == null ? ".*" : resolvedEventIdPattern;
}
public String getEventIdPattern() {
return eventIdPattern;
}
}
中输入regExpEventHandler=^(901|909|998|1000)$
dummyEventHandler=^([1-9][0-9]{0,2}|1000)$
。
如果日志中的错误消息哪个对象为空,那将会很有帮助。