none
Any Changes in Csharp file is creating errors in visual studio RRS feed

  • Question

  • Any changes in AccountController.cs file is generating this errors. even if <g class="gr_ gr_13 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="13" id="13">i</g> change <g class="gr_ gr_10 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace" data-gr-id="10" id="10">an space</g> and remove again though this error occurs.
    Suppose in line number 30

    public ApplicationSignInManager SignInManager

            {

                get => _signInManager ?? HttpContext.GetOwinContext().Get<ApplicationSignInManager>();

                private set => _signInManager = value;

            }

    it is giving error that :

    Severity

    Code

    Description

    Project

    File

    Line

    Suppression State

    Error

    CS1513

    } expected

    TritronJudge

    C:\Users\lazyfahim\Source\Workspaces\Tritron Judge\TritronJudge\Controllers\AccountController.cs

    30

    N/A

    Error

    CS1043

    { or ; expected

    TritronJudge

    C:\Users\lazyfahim\Source\Workspaces\Tritron Judge\TritronJudge\Controllers\AccountController.cs

    30

    N/A

    Error

    CS1513

    } expected

    TritronJudge

    C:\Users\lazyfahim\Source\Workspaces\Tritron Judge\TritronJudge\Controllers\AccountController.cs

    30

    N/A

    which is totally and terribly not understandable. i didnt face this kind of situation with dot net. And i didn't know how to ask this question .


    Friday, November 23, 2018 10:07 AM

All replies

  • Hi,

    I suggest refactoring your code for maintainability and easy to read.

    Initialization should be in the constructor and parameterize. 

    Sample code:

    public class ClassName {

           private readonly ApplicationSignInManager _signInManager;

           public ClassName(ApplicationSignInManager signInManager){

              _signInManager = signInManager ??   HttpContext.GetOwinContext().Get<ApplicationSignInManager>();

           }

    }


    • Edited by MardyDacasin Saturday, November 24, 2018 5:28 PM
    Saturday, November 24, 2018 5:27 PM
  • Hi Fahim Abrar

    Welcome to the MSDN forum.

    Do you mean that only when you make changes to this specific AccountController.cs file in this project will get an error, am I right? Other project or create a new project to test it again.

    Based on your error message, please check if it is relevant to extra “{}” symbol.

    Since our forum mainly focus on .NET Framework Setup and Servicing issue. Your issue seems be related to ASP .NET issue. So I recommend you redirect to ASP .NET forum and start a new thread with those error message and specific code for a more professional support.

    Thank you for your understanding.

    Best Regards

    May


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Monday, November 26, 2018 6:53 AM
    Moderator