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 with .NET development in Visual Studio. He highlights the tool's ability to enhance productivity by providing relevant code suggestions and explanations through a natural language interface. Downey demonstrates how to use Copilot Chat for debugging, understanding regular expressions, and generating tests. He also addresses the importance of responsible AI use with built-in content safety systems and emphasizes the necessity of validating the suggestions provided by the tool through testing and personal understanding. The session showcases the potential of AI in streamlining development workflows and the proactive approach to ensure the accuracy and safety of AI-assisted code.

Takeaways

  • 📈 **Productivity Boost**: GitHub Copilot Chat can significantly enhance .NET developers' productivity by integrating into their development workflows in Visual Studio.
  • 🛡️ **Content Safety**: The platform includes multiple mitigation layers to ensure the content generated is safe and free from harmful elements like hate speech or racism.
  • 🤖 **AI Model**: The core of GitHub Copilot Chat is an advanced AI model that processes data responsibly, ensuring good input and output quality.
  • 📖 **Contextual Assistance**: The tool provides assistance based on the current context of the developer's work, making it highly relevant to the task at hand.
  • 🔍 **Code Understanding**: Developers can ask questions about specific code segments, and GitHub Copilot Chat will analyze and explain the code in a natural language format.
  • 🔧 **Code Generation**: The tool can generate code snippets based on natural language prompts, which developers can then refine and test to fit their specific needs.
  • 🖼️ **CSS Assistance**: For front-end development, GitHub Copilot Chat can help with CSS, offering solutions to layout and styling challenges.
  • 🔗 **Fediverse Integration**: The script discusses integrating a blogging engine with the fediverse, using the ActivityPub standard for decentralized communication.
  • 🕵️‍♂️ **Debugging Aid**: GitHub Copilot Chat can assist in debugging by providing insights into exceptions and potential issues within the code.
  • 📝 **Legacy Code Management**: The tool aids in understanding, updating, and maintaining legacy code, which is crucial for ongoing software development.
  • 📋 **Testing and Validation**: Emphasizes the importance of testing generated code thoroughly to ensure it meets the required standards and functions correctly.

Q & A

  • What is the main topic of discussion in the provided transcript?

    -The main topic of discussion is the use of GitHub Copilot Chat to accelerate .NET development within Visual Studio, including demonstrations of its capabilities and responsible usage.

  • Who is the speaker in the transcript?

    -The speaker is Mark Downey, a product manager on the Visual Studio debugging and diagnostics team.

  • What are the mitigation layers mentioned for responsible use of GitHub Copilot?

    -The mitigation layers include the platform itself with the open AI model, a content safety system to ensure appropriate use of data, and a user experience layer within Visual Studio or Visual Studio Code.

  • How does the speaker propose to select a hero image for a blog post?

    -The speaker proposes marking each image with a class attribute and suggesting it as the hero image, allowing for explicit selection rather than implicitly picking the first image.

  • What is the speaker's role in the open-source project 'Dos Blog'?

    -The speaker has been shepherding the 'Dos Blog' project for about eight years, which is a blogging engine used by himself and others worldwide.

  • How does the speaker use GitHub Copilot to understand and rewrite code?

    -The speaker uses GitHub Copilot's inline chat feature to ask questions about specific code or regular expressions, receiving explanations and suggestions to rewrite methods according to his needs.

  • What is the issue the speaker encounters with the hero image in the blog post?

    -The issue is that the hero image appears squashed, indicating a potential problem with the CSS styling rather than the code for selecting the hero image.

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

    -The speaker is implementing an activityPub controller to allow 'Dos Blog' to communicate with other servers in the fediverse, following the activityPub standard.

  • What is the approach the speaker takes to test and validate the new code generated by GitHub Copilot?

    -The speaker plans to unit test the new code, make it his own by adjusting and refining it, and ensure it fits the purpose and style of his project.

  • What is the significance of the conversational aspect of GitHub Copilot when debugging?

    -The conversational aspect allows for an ongoing dialogue with GitHub Copilot, providing hypotheses about issues, requesting additional information, and refining the debugging process based on feedback.

  • What are the prerequisites for using the GitHub Copilot extensions in Visual Studio?

    -To use the GitHub Copilot extensions, one needs a GitHub Copilot for Individuals license or a GitHub Copilot for Business license.

  • How does the speaker describe the potential benefits of using GitHub Copilot for .NET developers?

    -The speaker describes the potential benefits as increased productivity, better understanding and updating of legacy code, assistance with CSS, and integrated exception helper for clues about problems.

Outlines

00:00

🚀 Introduction to GitHub Copilot Chat for Net Development

Mark Downey, a product manager on the Visual Studio debugging and diagnostics team, introduces the audience to GitHub Copilot Chat. He discusses its potential to increase productivity in .NET development within Visual Studio. The conversation is grounded in responsible use, with multiple layers of mitigation in place to ensure safety and content appropriateness. The platform's core is the Open AI model, surrounded by a content safety system and user experience layer within Visual Studio. The goal is to provide relevant and accurate information to developers, accelerating their workflow.

05:02

🤖 Leveraging AI for Code Understanding and Regular Expressions

The speaker demonstrates using GitHub Copilot Chat to understand unfamiliar code and to write a regular expression for a specific task. He explains how the AI provides context-aware assistance, allowing him to ask questions directly in the code editor. The AI breaks down a regular expression and explains its function, then helps to rewrite a method to find a 'hero image' in blog content based on a class attribute. The speaker emphasizes the importance of validating AI-generated code to ensure it meets the developer's needs.

10:03

🖼️ CSS and Image Presentation in a Blog Engine

The paragraph showcases the process of improving the visual presentation of images in a blog engine. The speaker discusses a CSS issue where an image appears squashed and uses inline questions with GitHub Copilot to generate appropriate CSS to display the image correctly. The AI provides a solution that involves floating an image within a div with specified width and height constraints. The speaker then manually adjusts the provided code to fit the context of the project and verifies its functionality.

15:05

🔍 Debugging and Testing with GitHub Copilot

The speaker details his experience with debugging and testing code using GitHub Copilot. He describes an issue with an image not being found due to missing a 'hero image' class tag in the data. After correcting the data, the speaker encounters a serialization issue during testing. Using GitHub Copilot, he engages in a conversational debugging process, which helps him identify a potential cause related to an empty string in JSON serialization. The AI suggests verifying the JSON value before serialization, leading to the discovery of an empty string that indicates a problem upstream in the call stack.

20:07

🌐 ActivityPub Standard and Federating a Blog with the Fediverse

The speaker discusses the implementation of the ActivityPub standard to federate his blog, 'Dos Blog', with the fediverse, a network of servers that can communicate with each other. He talks about creating an activity PB controller and ensuring its endpoints meet the standard. The speaker uses the test explorer in Visual Studio to run and debug tests for these new components. An exception occurs during testing, which the speaker investigates with the help of GitHub Copilot, leading to a successful resolution and completion of the test.

25:09

📝 Conclusion and Accessing GitHub Copilot Chat Features

The speaker concludes the video by summarizing the benefits of using GitHub Copilot Chat for .NET developers in Visual Studio. He highlights the ability to understand and update legacy code, the assistance provided in generating and debugging code, and the use of exception helper features. The speaker provides links for accessing GitHub Copilot Chat and emphasizes the need for a Copilot for Individuals or Business license to use the extensions. He thanks the audience for their time and encourages them to try out the features.

Mindmap

Keywords

💡GitHub Copilot

GitHub Copilot is an AI-powered code generation tool developed by GitHub and OpenAI. It assists developers by providing code suggestions and completing code snippets based on the context of the code being written. In the video, it is used to accelerate .NET development workflows by generating code, explaining regular expressions, and assisting with debugging.

💡.NET

.NET is a free, cross-platform, open-source developer platform for building many types of applications. It supports multiple programming languages, devices, and operating systems. In the context of the video, .NET is the framework within which the developer is working and improving their blogging engine.

💡Visual Studio

Visual Studio is an integrated development environment (IDE) from Microsoft that is used for developing applications across various platforms. In the video, it is the primary tool where GitHub Copilot is being used to enhance productivity and code generation.

💡Productivity

Productivity in the context of the video refers to the efficiency and effectiveness with which a developer can complete tasks and deliver applications. The use of GitHub Copilot aims to increase developer productivity by automating parts of the coding process.

💡Regular Expressions

Regular expressions are a powerful tool used in programming for matching patterns in strings. In the video, the developer uses regular expressions to manipulate and extract information from HTML content, specifically for selecting a hero image in a blog post.

💡Content Safety System

A content safety system is a mechanism that ensures the content generated or processed by an application adheres to certain guidelines and does not promote harmful or inappropriate material. In the video, it is mentioned as a layer of protection around the AI model to prevent the generation of harmful content.

💡User Experience Layer

The user experience layer refers to the interface and interactions within an application that affect the user's perceptions and feelings about the system. In the context of the video, it pertains to the integration of GitHub Copilot within Visual Studio to provide a seamless and helpful experience for developers.

💡Meta Prompts

Meta prompts are guiding questions or statements that help shape the output of an AI system by providing context or specific goals. In the video, meta prompts are used to ground the AI's responses to the current task or problem the developer is facing.

💡Debugging

Debugging is the process of identifying and removing errors or bugs from a program. The video demonstrates how GitHub Copilot can assist in debugging by providing insights into exceptions and suggesting solutions to the developer.

💡Fediverse

The Fediverse refers to a network of interoperable platforms, servers, and communities that are part of a federated system. It allows for decentralized communication and content sharing. In the video, the developer discusses integrating their blogging engine with the Fediverse using the ActivityPub standard.

💡ActivityPub

ActivityPub is a decentralized social networking protocol that allows for content sharing and communication across different platforms and servers. It is mentioned in the video as the standard that the developer is implementing to make their blogging engine part of the Fediverse.

Highlights

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

GitHub Copilot Chat is designed to enhance developer productivity with a responsible approach that includes multiple mitigation layers for safety.

The platform uses an open AI model to ensure good data input and output, surrounded by a content safety system.

User experience within Visual Studio or Visual Studio Code is improved through meta prompts and grounding for accurate results.

Developers can ask GitHub Copilot Chat questions inline to get context-based assistance, such as understanding regular expressions.

GitHub Copilot Chat can generate new methods or rewrite existing ones based on natural language prompts from the developer.

Mark demonstrates using GitHub Copilot Chat to rewrite a method for selecting a hero image in a blog post.

Developers are encouraged to test and validate code generated by GitHub Copilot Chat to ensure it fits their specific needs.

GitHub Copilot Chat assists with CSS by generating code snippets based on natural language descriptions of the desired style.

Mark shares his experience of using GitHub Copilot Chat to troubleshoot and resolve a serialization issue in testing.

The conversational aspect of GitHub Copilot Chat allows for an ongoing dialogue to help pinpoint and solve complex problems.

GitHub Copilot Chat can help create tests for new code, including both positive and negative test cases.

Mark emphasizes the importance of making generated code your own by testing and validating it thoroughly.

GitHub Copilot Chat is integrated with Visual Studio and requires a specific license for full functionality.

The use of GitHub Copilot Chat can help .NET developers become more productive, understand legacy code, and update it effectively.

Mark provides links for accessing GitHub Copilot Chat features in Visual Studio.

The session concludes with a demonstration of how GitHub Copilot Chat can be a compelling tool for .NET developers.