Ensure that calls into EnvDTE.CodeModel work even if the underlying...
Ensure that calls into EnvDTE.CodeModel work even if the underlying FileCodeModel has not been realized When calling into an EnvDTE.CodeModel API, the caller must pass the file name of the file to be operated on. For example: var ns = codeModel.AddNamespace("MyFile.cs", "MyNamespace"); However, the implementation EnvDTE.CodeModel would only ever succeed to find the FileCodeModel for "MyFile.cs" if had already been created and cached. If the FileCodeModel wasn't in the cache, the API that was called would throw. Ultimately, this comes down to a set of APIs with bad names that don't reflect that they only return cached values. This change renames those APIs to give them proper names (e.g. TryGetCachedFileCodeModelInstance) and adds an API that will retrieve a cached FileCodeModel or create a new one if needed.
Showing
想要评论请 注册 或 登录