1. 09 3月, 2015 1 次提交
    • J
      Stop emitting assembly / PDB to a temp directory · 22e86fe4
      Jared Parsons 提交于
      When a compilation fails the compiler should not delete or edit the outputs of a previous successful.  They should remain around to satisfy scenarios like F5 on build failure.
      
      Roslyn implemented this logic by doing the following:
      
      - Creating a `Stream` for the assembly / PDB in a temp directory.
      - Running the compilation.
      - Moving the `Stream` to the desired output location on success.
      
      This introduced a subtle bug into the compiler.  When the source + dest of `File.Move` are on the same volume the destination file will end up with the ACLs it got from being created in the source directory.  In this example it meant the assembly / PDB had the ACLs of the temp directory not the actual output one.
      
      This can produce breaks in cases where the temp and output directory have different inheritable ACLS.  This case comes up for instance in ASP.Net.
      
      To fix this we are going back to the native compiler behavior here.  The creation of the `Stream` objects will be delayed until we are ready to write to disk (happens after the compilation is verified to have no errors).
      
      Because this portion of the compiler is on .NET 4.5.2 the Emit layer cannot open the files directly (no file system API to use).  Instead we pass down the `EmitStreamProvider` abstraction from the desktop layer and let that control the openning of the files.
      
      This change also allows us to remove all of the temp directory logic from the compiler and build protocol.
      
      Note: Whether or not to make this entry point a public API is being considered separately from this thread.  If we decide to make this public it will be done as a separate follow up change.
      22e86fe4
  2. 07 3月, 2015 1 次提交
  3. 06 3月, 2015 2 次提交
  4. 04 3月, 2015 1 次提交
  5. 21 2月, 2015 1 次提交
  6. 20 2月, 2015 1 次提交
  7. 18 2月, 2015 1 次提交
    • O
      Added a 'suppressAccessChecks' parameter to Compilation.GetSemanticModel · f91f779b
      Omer Raviv 提交于
      Calling GetSemanticModel with suppressAccessChecks=true creates a SemanticModel that ignores accessibility rules when answering semantic questions.
      This allows consumers to ask semantic questions using the same semantic rules as the ones used in debugger’s Expression Evaluator, where accessibility rules do not matter.
      
      Added unit tests for C# and VB.NET to cover both regular and speculative analysis.
      f91f779b
  8. 14 2月, 2015 2 次提交
  9. 09 2月, 2015 1 次提交
  10. 27 1月, 2015 1 次提交
    • J
      After some discussion between Neal, Sri and myself we decided to make... · ea718c30
      jaredpar 提交于
      After some discussion between Neal, Sri and myself we decided to make AsyncQueue<T> and CompilationEvent internal. The justification for this was:
      
      - At the time there is no need for this type to be public. Ideally the IDE and Compiler would be structured in a way that making it public was needed but for now it is not done that way.
      - AsyncQueue<T> feels like a type which should be in BCL, not Roslyn.
      - No concrete need for making this public at the moment.
      
      Given that we decided to make it internal for now. One of the main hopes here is we can convince the BCL to take ownership of the AsyncQueue<T>. If we make it public now, even if they add such a type we'd never get to consume it.
       (changeset 1404591)
      ea718c30
  11. 25 1月, 2015 1 次提交
    • J
      Change the file encoding of many files back to UTF-8. · cfdd6068
      jaredpar 提交于
      These were accidentally changed to UTF-16LE during a recent scripted change.  This went unnoticed because the encoding change didn't register in CodeFlow (indeed if you view a shelve of this change in CodeFlow it will report no changes).  UTF-16 does not work well with Git as it is often interpreted as a binary file.  Moving back to UTF-8 so our GitHub experience works well for customers.
      
      closes #66 (changeset 1403787)
      cfdd6068
  12. 24 1月, 2015 1 次提交
    • B
      First step in moving the compiler code base to the .Net Foundation coding style. · 16512b64
      beep boop 提交于
      Background:
      
      As discussed in the dev team all hands all code under the GitHub dotnet foundation is using a single process for contribution, API review, infrastructure and coding style. The idea is to present a unified view to our customer and give them a single story for contributing to any project under the dotnet foundation.
      
      https://github.com/dotnet/corefx/wiki/Contributing#c-coding-style
      
      The coding style transition is automated using a Roslyn based rewrite tool:
      
      https://github.com/dotnet/codeformatter
      
      This will be applied in stages across our developer tree. Right now the focus is on the Open directory as this is what is being presented on github. Code owners will be contacted before the transition happens.
      
      Note: this is a soft style requirement. There are no build errors that come from this change.
       (changeset 1403394)
      16512b64
  13. 20 1月, 2015 1 次提交
  14. 15 1月, 2015 1 次提交
  15. 14 1月, 2015 1 次提交
  16. 09 1月, 2015 3 次提交
    • R
      Move Compilation.WithAnalyzers out of Compilation and make it an extension... · bb206458
      RoslynTeam 提交于
      Move Compilation.WithAnalyzers out of Compilation and make it an extension method. (changeset 1392997)
      bb206458
    • M
      Fix for bug 1098490: AnalyzerDriver can deadlock with bad CompilationEventQueue · 066eeae5
      manishv 提交于
      AnalyzerDriver is currently tightly coupled with the sequence and kind of CompilationEvents being produced by the compilation. It requires that the first event on the queue is a compilation started event and the final event is the compilation end event. If either of these events are not produced OR are out of expected order then the driver can deadlock.
      
      This change cleans this up by:
      1) Ignoring the CompilationStartedEvent in the analyzer driver: This event was only triggering initialization of some lazy fields on the driver: compilation, analysis scope, declaration analyzers and event processing task. This code has been refactored into an Initialize method which is triggered in AnalyzerDriver.Create immediately after a new compilation is created with driver's event queue.
      
      2) Clean up ProcessCompilationCompletedAsync: Move the await of syntax tree analyzer tasks and DiagnosticQueue.Complete invocation out of this method into the primary driver task. This method now just invokes all the compilation end actions and doesn't do any post processing.
      
      I have also cleaned up the analyzer test framework a bit. (changeset 1392961)
      066eeae5
    • R
      ba123ce3
  17. 07 1月, 2015 1 次提交
  18. 24 12月, 2014 2 次提交
  19. 22 11月, 2014 1 次提交
  20. 20 11月, 2014 1 次提交
  21. 13 11月, 2014 2 次提交
    • P
      Add a diagnostic (not yet part of the toolset) to ensure CancellationToken... · 3387b4d8
      Pilchie 提交于
      Add a diagnostic (not yet part of the toolset) to ensure CancellationToken arguments are last* and fix violations.
      
      * Unless they are followed by params, out, ref, or optional parameters (without themselves being optional), or are interface implementations or overrides.
      
      * I suppressed the warnings in the TaskExtensions and TaskFactoryExtensions types, since we're trying to mirror the TPL's APIs there.
      
      Includes some tests for C# scenarios, and a fixer for C# that just reorders the signature (arguably, it's better to just let the user invoke Change Signature themself). (changeset 1370978)
      3387b4d8
    • H
      [Open] added new API in compiler · 9dd89b56
      heejaechang 提交于
           ContainsSymbolsWIthName and GetSymbolsWithName which can be used to either check whether certain name exist in the compilation without using symbol or get those symbols that has the name.
      
           also added corresponding API in workspace layer so that it can be used in IDE as well for things like SymbolFinder
      
           we are planning to use it further more in features such as "NavigateTo" (changeset 1370769)
      9dd89b56
  22. 07 11月, 2014 1 次提交
  23. 29 10月, 2014 1 次提交
    • J
      Create an analyzer to detect verbatim crefs, clean up our codebase to match. · 349040ab
      jasonmalinowski 提交于
      In some parts of our codebase, we use "verbatim crefs" where the compiler just passes the cref name out to the XML file and doesn't do any analysis of it. While there are some legitimate uses of these, there were many abuses in our source code. Worst of all, in some cases we had verbatim crefs on public types that referenced types that had since been renamed, or the syntax was wrong, etc. With this change, there's now an analyzer that issues a warning for all uses of them. In the places that are fair uses of them, the warning is suppressed. Going forward, adding suppressions should be considered fine as long as:
      
      1) it's a reference to something in another layer or language
      2) it's some framework type that's clearly never going to change ever
      
      Otherwise, a proper, verifiable syntax should be used. Again, this isn't to say that verbatim crefs are universally bad, but just that we've proven we make mistakes with them and some guards should be put in place. (changeset 1360175)
      349040ab
  24. 17 10月, 2014 1 次提交
  25. 07 10月, 2014 1 次提交
    • T
      Introduces EmitOptions for options passed to Compilation.Emit(). · 1621a00f
      TomasMatousek 提交于
           Moves options that were previously on CompilationOptions but were not used until emit phase to EmitOptions: fileAlignment, baseAddress, highEntropyVirtualAddressSpace, subsystemVersion, runtimeMetadataVersion. They hold on values written to various PE headers. We can now easily add other similar PE flags to EmitOptions, which is a common customer request, without affecting code that works with compilation options in other layers (workspaces, project system, etc.).
      
           Removes EmitMeadataOnly method and instead adds a MetadataOnly flag to EmitOptions. Removes MetadataOnlyEmitOptions - they were not used and can now be easily added as bools to EmitOptions.
      
           Moves pdbFilePath and outputName from parameters of Emit to EmitOptions.
      
      IDE: remove tracking of options that were moved to EmitOptions, since the IDE doesn't care about options that don't affect compilation. (changeset 1348623)
      1621a00f
  26. 27 9月, 2014 1 次提交
  27. 25 9月, 2014 2 次提交
    • R
      Replace IDiagnosticAnalyzer with DiagnosticAnalyzer, and move to an... · 010d4bda
      RoslynTeam 提交于
      Replace IDiagnosticAnalyzer with DiagnosticAnalyzer, and move to an action-based diagnostic analysis model. (changeset 1337816)
      010d4bda
    • P
      PERF: String allocations in feature check. · 7f177c76
      Pharring 提交于
      The compiler's feature check uses a dictionary keyed on string. The keys are case insensitive so, rather than using ".ToLowerInvariant" on every lookup, I added an equality comparer. Since this is portable, we don't have an InvariantCulture comparer, so I switched it to Ordinal. Ordinal comparison is sufficient for compiler feature flags.
      This was responsible for 0.1% of allocations in the C# typing test:
           Name                                                                   Inc %          Inc
           |+ mscorlib.ni!String.ToLower                                            0.1    7,276,920
           | + Microsoft.CodeAnalysis.ni!Compilation.Feature                        0.1    7,062,104
           | |+ Microsoft.CodeAnalysis.CSharp.ni!DisposeCheckerPass.Analyze         0.1    4,175,664
      
      because "DisposeCheckerPass" checks for the presence of the "checkdispose" feature. (changeset 1335644)
      7f177c76
  28. 15 8月, 2014 1 次提交
    • T
      Replaces CompilationOptions.Optimize and... · 9fbe1432
      TomasMatousek 提交于
      Replaces CompilationOptions.Optimize and CompilationOptions.DebugInformationKind with a single enum OptimizationLevel that has two values: Release and Debug.
      Removes dependency in IL generation on whether PDB stream is passed to Emit or not. IL shall only differ between Release and Debug.
      
      Command line arguments /optimize, /debug and /pdb remain the same, their values map to either Release or Debug. The value of /optimize is mapped to Release or Debug. /debug+, /debug:full and /debug:pdbonly have all the same effect - enable generating PDB file. They don't influence the generated IL.
      
      Debug information/instrumentation (sequence points, dead stores, nops, etc.) doesn't need to be emitted for synthesized methods that don't contain user code (property GenerateDebugInfo on a symbol returns true).
      
      During lowering always create bound sequence nodes. In some scenarios (PDB stream is not passed, we are emitting helper that contains no user code) these nodes are not used. However, in mainstream scenarios we always emit PDBs, so optimizing the bound nodes away is optimizing for uncommon case and just increases test matrix. Lambda, iterator and async lowering have to handle presence of bound sequence point nodes. We get more test coverage if they are always present.
      
      Another reason why to always create bound sequence points is to avoid complexity and ambiguity when checking if a symbol needs debug information. Some symbols might need debug information during some lowering phases but not other. For example, the generated body of a method symbol that represents an async kick-off method doesn't need debug information since it doesn't contain any user code. However, all source code contained in an async method should have debug information emitted. Bound tree for such code is lowered in the context of the async method symbol, so the value of GenerateDebugInfo for the async method symbol would need to differ depending on which phase of compilation are we in.
      
      Finally, IL body deduplication can always be enabled (in Release and Debug), even in EnC scenarios. Removing another compiler knob further simplifies testing.
       (changeset 1316430)
      9fbe1432
  29. 05 8月, 2014 2 次提交
    • N
      529546-Extend EmitMetadataOnly to support resources · 712808f7
      nmgafter 提交于
      and add parameters to the API for upcoming anticipated changes to support reference assemblies. (changeset 1310516)
      712808f7
    • M
      Switch the command line compilers to use the newly implemented event queue... · 253a92f2
      manishv 提交于
      Switch the command line compilers to use the newly implemented event queue based AnalyzerDriver for executing diagnostic analyzers. This change primarily (a) Fixes AnalyzerDriver.AnalyzeDeclaringReference to correctly compute the syntax nodes to be analyzed by syntax and code block analyzers (b) Port all unit tests to use the new driver (c) Delete the current AnalyzerDriver. (changeset 1308719)
      253a92f2
  30. 02 8月, 2014 2 次提交
  31. 02 7月, 2014 1 次提交