GitHub Copilot Tips for .NET Developers | .NET Conf 2023

dotnet
16 Nov 202328:46

TLDRMark Downey, a product manager on the Visual Studio debugging and Diagnostics team, discusses the integration of GitHub Copilot Chat in Visual Studio to enhance .NET development productivity. He demonstrates how the tool can be used to understand and rewrite code, particularly in regular expressions, and addresses the importance of testing and validating code. Downey also explores the use of Copilot for CSS issues and debugging, emphasizing the conversational aspect of problem-solving with the AI. He concludes by highlighting the benefits of using Copilot for legacy code updates and its potential to improve developer efficiency in .NET development.

Takeaways

  • πŸš€ **GitHub Copilot Integration**: Mark Downey discusses the integration of GitHub Copilot with Visual Studio to enhance .NET development productivity.
  • πŸ€– **AI Model and Content Safety**: The platform uses an AI model surrounded by a content safety system to ensure the quality and appropriateness of the output.
  • πŸ“ˆ **Productivity Boost**: GitHub Copilot aims to significantly increase developer productivity by providing relevant code and solutions quickly.
  • 🧩 **Contextual Assistance**: Copilot provides assistance based on the current context within the code, allowing for more accurate and personalized support.
  • πŸ” **In-Line Inquiry**: Developers can use the ALT/slash key to bring up in-line chat with Copilot to ask questions directly related to their code.
  • πŸ’‘ **Understanding Code**: Copilot helps in understanding existing code by breaking down complex parts, such as regular expressions.
  • πŸ”§ **Code Customization**: It assists in customizing and rewriting code snippets to fit specific developer needs, such as finding a 'hero image' in a blog post.
  • πŸ–Œ **CSS Assistance**: Copilot also aids with CSS, providing code to style elements based on natural language descriptions of the desired layout.
  • πŸ”¬ **Testing and Validation**: Emphasizes the importance of testing and validating code generated by Copilot to ensure it meets the developer's requirements.
  • 🌐 **Fediverse Integration**: Mark talks about integrating Dos Blog with the fediverse using the ActivityPub standard, showcasing how Copilot can assist with new and complex implementations.
  • πŸ› **Debugging Support**: Copilot aids in debugging by providing insights into exceptions and errors, guiding developers towards a solution through a conversational interface.

Q & A

  • What is the main topic of the discussion led by Mark Downey?

    -The main topic of the discussion is about GitHub Copilot Chat and how it can be used to accelerate .NET development within Visual Studio.

  • What does Mark Downey emphasize as the key aspect of using GitHub Copilot Chat?

    -Mark Downey emphasizes the importance of using GitHub Copilot Chat in a responsible way, with multiple mitigation layers to ensure the safety and appropriateness of the content it generates.

  • How does the speaker describe the role of the platform's model in the context of GitHub Copilot Chat?

    -The platform's model, which is based on Open AI, plays a central role in ensuring that the data going into it is good and that the output is also good, thus maintaining the quality of the content generated.

  • What is the purpose of the Content Safety System mentioned in the transcript?

    -The Content Safety System is designed to filter data and ensure that the content delivered is appropriate, useful, and free from harmful elements such as hate speech or racism.

  • How does the user experience layer within Visual Studio or Visual Studio Code play a role in GitHub Copilot Chat?

    -The user experience layer is crucial for providing a seamless interface for developers to interact with GitHub Copilot Chat, ensuring that the information delivered is relevant to the task at hand.

  • What is the issue that Mark Downey has been trying to address in his Dos blog project?

    -The issue is related to selecting a hero image from a blog post. Currently, the system automatically selects the first image it encounters as the hero image. Mark wants to improve this by allowing the selection of multiple images within a post and manually marking one as the hero image.

  • How does Mark Downey use GitHub Copilot Chat to understand the existing code in his project?

    -Mark uses the 'ask co-pilot' inline chat feature to ask questions about the existing code, such as the purpose of a specific regular expression, and receives explanations that help him understand and work with the code more effectively.

  • What is the proposed solution to the hero image selection issue in the Dos blog project?

    -The proposed solution is to mark each image with a class attribute that suggests it as the hero image, allowing for explicit selection rather than implicitly picking the first image encountered.

  • How does GitHub Copilot Chat assist with writing or rewriting code?

    -GitHub Copilot Chat assists by generating code snippets based on natural language descriptions provided by the user. It uses the context of the question and the surrounding code to produce relevant and contextually appropriate code.

  • What is the importance of testing the code generated by GitHub Copilot Chat?

    -Testing the code is crucial to ensure that it meets the developer's requirements and is fit for purpose. It allows the developer to make the code their own by validating its functionality and making any necessary adjustments.

  • How does the speaker plan to integrate Dos blog into the fediverse?

    -The speaker plans to implement an 'activity PB controller' that adheres to the ActivityPub standard, which would allow Dos blog to communicate and interact with other servers in the fediverse, facilitating activities like following and being followed.

  • What is the role of the test explorer in verifying the functionality of new code?

    -The test explorer is used to run tests around the new parts of the codebase, ensuring that they work as designed and helping to identify any issues or exceptions that may occur during execution.

Outlines

00:00

πŸ˜€ Introduction to GitHub Copilot Chat for Productivity

Mark Downey, a product manager on the Visual Studio debugging and diagnostics team, introduces GitHub Copilot Chat. He discusses its potential to enhance .NET development productivity within Visual Studio. The video aims to demonstrate how developers can integrate Copilot Chat into their workflows for accelerated development. Downey emphasizes the importance of responsible development, highlighting the platform's multiple safety and content mitigation layers, including an open AI model and a content safety system to prevent harmful outputs.

05:02

πŸ” Exploring GitHub Copilot Chat's In-Context Assistance

The speaker demonstrates how to use GitHub Copilot Chat for in-context assistance. He uses the 'ALT/slash' key command to bring up the chat and asks about a regular expression within his code. The chat provides a breakdown of the regex, explaining its components and function. Downey then requests a new method to find a 'hero image' in blog content using regex, to which Copilot Chat responds with a suggested code snippet. He emphasizes the need for developers to review and test the provided code to ensure it meets their specific requirements.

10:03

πŸ“Έ Addressing CSS and Image Display Issues

Downey encounters a CSS issue where an image appears squashed in his blogging engine, Dos Blog. He uses the in-line chat feature to request a CSS solution for displaying an image within a new div, specifying dimensions and a float to the right. After receiving a response, he manually adjusts the code to fit his project's style. The importance of testing and validating code is reiterated as he proceeds to debug and ensure the new CSS code functions correctly.

15:05

πŸ”— Integrating Dos Blog with the Fediverse

The discussion shifts to integrating Dos Blog with the fediverse using the ActivityPub standard. Downey outlines his progress on an ActivityPub controller and the need for endpoints to meet the standard. He uses the test explorer to run and debug tests for these new components, aiming to ensure they work correctly. When an exception occurs, he engages in a conversation with Copilot Chat to diagnose and resolve the serialization issue.

20:07

πŸ› οΈ Debugging and Conversational Problem-Solving with Copilot

Facing a serialization exception, Downey utilizes Copilot Chat's conversational interface to troubleshoot the problem. The chat suggests that an empty string value for JSON could be the issue, prompting Downey to verify this by checking the value before serialization. Through an interactive exchange, Copilot Chat helps him identify that the stream was not reset, which was causing the serialization problem. After applying the suggested fix and re-running the test, the issue is resolved, and the test succeeds.

25:09

πŸ“š Conclusion and Accessing GitHub Copilot Chat

In conclusion, Downey thanks the audience for joining the discussion on GitHub Copilot Chat. He recaps the features and benefits for .NET developers in Visual Studio, including understanding and updating legacy code, CSS assistance, and exception handling. He provides links to access the Copilot Chat and Copilot extensions, noting that a license for individuals or businesses is required for the extensions to work.

Mindmap

Keywords

πŸ’‘GitHub Copilot

GitHub Copilot is an AI-powered code generation tool that assists developers by writing code suggestions. In the video, it is used to accelerate .NET development by generating code snippets and explanations, thus enhancing productivity.

πŸ’‘.NET Development

.NET Development refers to the process of creating applications using the .NET framework, which is a software development platform developed by Microsoft. The video discusses how GitHub Copilot can be integrated into .NET development workflows to improve efficiency.

πŸ’‘Productivity

Productivity in the context of the video refers to the efficiency and effectiveness with which developers can create and maintain code. The speaker emphasizes the potential of GitHub Copilot to increase productivity by automating certain coding tasks.

πŸ’‘Regular Expressions

Regular expressions are a powerful tool used in programming for matching patterns in strings. In the video, the speaker discusses the difficulty of working with regular expressions and how GitHub Copilot can assist in understanding and generating them.

πŸ’‘Content Safety System

A Content Safety System is a mechanism that ensures the content generated or processed by an application adheres to certain standards, avoiding inappropriate material. The video mentions this system in the context of GitHub Copilot to highlight its responsible use.

πŸ’‘User Experience Layer

The User Experience Layer refers to the interface and interactions within an application that a user encounters. The video discusses the integration of GitHub Copilot within Visual Studio's user experience layer to provide a seamless development environment.

πŸ’‘Visual Studio

Visual Studio is an integrated development environment (IDE) from Microsoft that is widely used for .NET development. The video demonstrates how GitHub Copilot can be used within Visual Studio to aid in coding tasks.

πŸ’‘Code Testing

Code testing involves verifying that the generated code works as expected under various conditions. The video emphasizes the importance of testing code generated by GitHub Copilot to ensure its correctness and reliability.

πŸ’‘CSS

CSS stands for Cascading Style Sheets, a language used for describing the presentation of a document written in HTML. The video discusses using GitHub Copilot to assist with CSS, particularly in styling an image for a blog post.

πŸ’‘ActivityPub

ActivityPub is a decentralized social networking protocol that allows for interoperability between different platforms, known as the 'fediverse'. The video touches on integrating a blogging engine with ActivityPub to enable participation in the fediverse.

πŸ’‘Exception Handling

Exception handling is a programming technique for responding to unusual conditions that occur during the execution of a program. In the video, the speaker uses GitHub Copilot to help debug an exception during testing, demonstrating its utility in problem-solving.

Highlights

Mark Downey discusses GitHub Copilot Chat and its potential to accelerate .NET development within Visual Studio.

GitHub Copilot Chat is designed to increase developer productivity through integrated AI assistance.

The platform includes multiple mitigation layers to ensure content safety and responsible AI usage.

The AI model is grounded in the context of the current task, providing relevant and accurate information.

Developers can ask natural language questions in-line to receive context-aware assistance from Copilot.

GitHub Copilot Chat can help understand and work with regular expressions, even for those not familiar with them.

The tool can generate and suggest code based on a developer's natural language description of a problem.

It's crucial for developers to validate and test the generated code to ensure it fits their specific needs.

GitHub Copilot Chat assists in debugging by providing insights into exceptions and potential issues in the code.

The AI can have a conversational approach to problem-solving, refining hypotheses based on developer feedback.

Developers can use GitHub Copilot Chat to create unit tests for their code, ensuring robustness and reliability.

The tool can help integrate .NET projects into the fediverse by assisting with the implementation of the ActivityPub standard.

Mark demonstrates how to use GitHub Copilot Chat for CSS issues, showing its versatility across different aspects of development.

GitHub Copilot Chat can read and analyze code context to provide more accurate and relevant assistance.

The tool can be used to understand legacy code and assist in updating or improving it.

A GitHub Copilot license is required for the full functionality of the AI assistance features in Visual Studio.

GitHub Copilot Chat is currently available in preview, offering a glimpse into the future of integrated AI development tools.