public ActionResult <IEnumerable <Vaccine> > Get() { IQueryable <Vaccine> vaccines = repository.GetAll(); Log.Information($"{CurrentMethod.GetName()}: получены все препараты"); return(Ok(vaccines)); }
int GetExternalInstructionOffset(ref CurrentMethod info, MethodDef method, Instruction instr) { if (info.Method == method) { return(info.GetOffset(instr)); } var body = method.Body; if (body == null) { Error("Method body is null"); return(0); } var instrs = body.Instructions; int offset = 0; for (int i = 0; i < instrs.Count; i++) { var currInstr = instrs[i]; if (currInstr == instr) { return(offset); } offset += currInstr.GetSize(); } if (instr == null) { return(offset); } Error("Async method instruction has been removed but it's still being referenced by PDB info: BP Instruction: {0}, BP Method: {1} (0x{2:X8}), Current Method: {3} (0x{4:X8})", instr, method, method.MDToken.Raw, info.Method, info.Method.MDToken.Raw); return(0); }
public IActionResult Delete(int id) { VaccinationVM vaccination = repository.GetByCondition(v => v.Id == id).FirstOrDefault(); if (vaccination == null) { Log.Information($"{CurrentMethod.GetName()}: прививка Id = {id} отсутствует в базе данных"); return(NotFound()); } try { repository.Delete(id); } catch (ArgumentNullException e) { Log.Error($"{CurrentMethod.GetName()}: при обработке запроса произошло исключение {e.GetType()}\n Метод вызвавший исключение: {e.TargetSite.Name}\n Параметр не может быть равен null\n Имя параметра: {e.ParamName}\n Стек вызовов:\n{e.StackTrace}"); return(StatusCode(500)); } catch (DbUpdateConcurrencyException e) { Log.Error($"{CurrentMethod.GetName()}: при обработке запроса произошло исключение {e.GetType()}\n Метод вызвавший исключение: {e.TargetSite.Name}\n Стек вызовов:\n{e.StackTrace}"); return(StatusCode(500)); } catch (DbUpdateException e) { Log.Error($"{CurrentMethod.GetName()}: при обработке запроса произошло исключение {e.GetType()}\n Метод вызвавший исключение: {e.TargetSite.Name}\n Стек вызовов:\n{e.StackTrace}"); return(StatusCode(500)); } Log.Information($"{CurrentMethod.GetName()}: удалена прививка Id = {id}"); return(Ok()); }
public ActionResult <IEnumerable <Vaccination> > Get() { IQueryable <VaccinationVM> vaccinations = repository.GetAll(); Log.Information($"{CurrentMethod.GetName()}: получены все прививки"); return(Ok(vaccinations)); }
public ActionResult <IEnumerable <Patient> > Get() { IQueryable <Patient> patients = repository.GetAll(); Log.Information($"{CurrentMethod.GetName()}: получены все пациенты"); return(Ok(patients)); }
int GetExternalInstructionOffset(ref CurrentMethod info, MethodDef method, Instruction instr) { if (info.Method == method) { return(info.GetOffset(instr)); } var body = method.Body; if (body == null) { Error("Method body is null"); return(0); } var instrs = body.Instructions; int offset = 0; for (int i = 0; i < instrs.Count; i++) { var currInstr = instrs[i]; if (currInstr == instr) { return(offset); } offset += currInstr.GetSize(); } if (instr == null) { return(offset); } Error("Instruction has been removed but it's referenced by PDB info"); return(0); }
public ActionResult <ResponseVM> Post([FromBody] Patient patient) { if (patient == null) { Log.Information($"{CurrentMethod.GetName()}: не удалось связать модель"); ResponseVM response400 = new ResponseVM { IsSuccess = false, ErrorMessage = "Bad request", StatusCode = 400, Result = "Не удалось связать модель, patient был равен null" }; return(BadRequest(response400)); } Patient sameSNILSPatient = null; try { sameSNILSPatient = repository.GetByCondition(p => p.SNILS == patient.SNILS).FirstOrDefault(); } catch (ArgumentNullException e) { Log.Error($"{CurrentMethod.GetName()}: при обработке запроса произошло исключение {e.GetType()}\n Метод вызвавший исключение: {e.TargetSite.Name}\n Параметр не может быть равен null\n Имя параметра: {e.ParamName}\n Стек вызовов:\n{e.StackTrace}"); ResponseVM response500 = new ResponseVM { IsSuccess = false, ErrorMessage = "Internal server error", StatusCode = 500, Result = "Внутренняя ошибка сервера" }; return(StatusCode(500, response500)); } if (sameSNILSPatient != null) { Log.Information($"{CurrentMethod.GetName()}: пациент с таким СНИЛС уже есть"); ResponseVM response409 = new ResponseVM { IsSuccess = false, ErrorMessage = "Conflict", StatusCode = 409, Result = "Пациент с таким СНИЛС уже есть" }; return(Conflict(response409)); } try { repository.Add(patient); } catch (DbUpdateConcurrencyException e) { Log.Error($"{CurrentMethod.GetName()}: при обработке запроса произошло исключение {e.GetType()}\n Метод вызвавший исключение: {e.TargetSite.Name}\n Стек вызовов:\n{e.StackTrace}"); ResponseVM response500 = new ResponseVM { IsSuccess = false, ErrorMessage = "Internal server error", StatusCode = 500, Result = "Внутренняя ошибка сервера" }; return(StatusCode(500, response500)); } catch (DbUpdateException e) { Log.Error($"{CurrentMethod.GetName()}: при обработке запроса произошло исключение {e.GetType()}\n Метод вызвавший исключение: {e.TargetSite.Name}\n Стек вызовов:\n{e.StackTrace}"); ResponseVM response500 = new ResponseVM { IsSuccess = false, ErrorMessage = "Internal server error", StatusCode = 500, Result = "Внутренняя ошибка сервера" }; return(StatusCode(500, response500)); } Log.Information($"{CurrentMethod.GetName()}: добавлен пациент Id = {patient.Id}"); ResponseVM response200 = new ResponseVM { IsSuccess = true, StatusCode = 200, Result = $"Добавлен пациент Id = {patient.Id}" }; return(Ok(response200)); }
public VarInfo GetVar(string name) { VarInfo res = null; if (CurrentMethod != null) { res = CurrentMethod.GetVar(name); } if (res == null && Self != null) { return(Self.GetField(name)); } return(res); }
void WriteAsyncMethod(ref CurrentMethod info, PdbAsyncMethodCustomDebugInfo asyncMethod) { if (asyncMethod.KickoffMethod == null) { Error("KickoffMethod is null"); return; } uint kickoffMethod = GetMethodToken(asyncMethod.KickoffMethod); writer3.DefineKickoffMethod(kickoffMethod); if (asyncMethod.CatchHandlerInstruction != null) { int catchHandlerILOffset = info.GetOffset(asyncMethod.CatchHandlerInstruction); writer3.DefineCatchHandlerILOffset((uint)catchHandlerILOffset); } var stepInfos = asyncMethod.StepInfos; var yieldOffsets = new uint[stepInfos.Count]; var breakpointOffset = new uint[stepInfos.Count]; var breakpointMethods = new uint[stepInfos.Count]; for (int i = 0; i < yieldOffsets.Length; i++) { var stepInfo = stepInfos[i]; if (stepInfo.YieldInstruction == null) { Error("YieldInstruction is null"); return; } if (stepInfo.BreakpointMethod == null) { Error("BreakpointInstruction is null"); return; } if (stepInfo.BreakpointInstruction == null) { Error("BreakpointInstruction is null"); return; } yieldOffsets[i] = (uint)info.GetOffset(stepInfo.YieldInstruction); breakpointOffset[i] = (uint)GetExternalInstructionOffset(ref info, stepInfo.BreakpointMethod, stepInfo.BreakpointInstruction); breakpointMethods[i] = GetMethodToken(stepInfo.BreakpointMethod); } writer3.DefineAsyncStepInfo(yieldOffsets, breakpointOffset, breakpointMethods); }
public ActionResult <IEnumerable <Vaccination> > GetVaccinations([FromRoute(Name = "patient-id")] int patientId) { // добавить проверку наличия пациента в бд // для этого в этом контроллере нужно получить PatientRepository IQueryable <VaccinationVM> vaccinations; try { vaccinations = repository.GetByCondition(v => v.PatientId == patientId); } catch (ArgumentNullException e) { Log.Error($"{CurrentMethod.GetName()}: при обработке запроса произошло исключение {e.GetType()}\n Метод вызвавший исключение: {e.TargetSite.Name}\n Параметр не может быть равен null\n Имя параметра: {e.ParamName}\n Стек вызовов:\n{e.StackTrace}"); return(StatusCode(500)); } Log.Information($"{CurrentMethod.GetName()}: получены все прививки для пациента PatientId = {patientId}"); return(Ok(vaccinations)); }
void WriteScope(ref CurrentMethod info, PdbScope scope, int recursionCounter) { if (recursionCounter >= 1000) { Error("Too many PdbScopes"); return; } int startOffset = info.GetOffset(scope.Start); int endOffset = info.GetOffset(scope.End); writer.OpenScope(startOffset); AddLocals(info.Method, scope.Variables, (uint)startOffset, (uint)endOffset); if (scope.Constants.Count > 0) { if (writer3 == null) { Error("Symbol writer doesn't implement ISymbolWriter3: no constants can be written to the PDB file"); } else { var constants = scope.Constants; var sig = new FieldSig(); for (int i = 0; i < constants.Count; i++) { var constant = constants[i]; sig.Type = constant.Type; var token = metaData.GetToken(sig); writer3.DefineConstant2(constant.Name, constant.Value ?? 0, token.Raw); } } } foreach (var ns in scope.Namespaces) { writer.UsingNamespace(ns); } foreach (var childScope in scope.Scopes) { WriteScope(ref info, childScope, recursionCounter + 1); } writer.CloseScope(startOffset == 0 && endOffset == info.BodySize ? endOffset : endOffset - localsEndScopeIncValue); }
void WriteScope(ref CurrentMethod info, PdbScope scope, int recursionCounter) { if (recursionCounter >= 1000) { Error("Too many PdbScopes"); return; } int startOffset = info.GetOffset(scope.Start); int endOffset = info.GetOffset(scope.End); writer.OpenScope(startOffset); AddLocals(info.Method, scope.Variables, (uint)startOffset, (uint)endOffset); if (scope.Constants.Count > 0) { var constants = scope.Constants; var sig = new FieldSig(); for (int i = 0; i < constants.Count; i++) { var constant = constants[i]; sig.Type = constant.Type; var token = metadata.GetToken(sig); writer.DefineConstant(constant.Name, constant.Value ?? boxedZeroInt32, token.Raw); } } var scopeNamespaces = scope.Namespaces; int count = scopeNamespaces.Count; for (int i = 0; i < count; i++) { writer.UsingNamespace(scopeNamespaces[i]); } var scopes = scope.Scopes; count = scopes.Count; for (int i = 0; i < count; i++) { WriteScope(ref info, scopes[i], recursionCounter + 1); } writer.CloseScope(startOffset == 0 && endOffset == info.BodySize ? endOffset : endOffset - localsEndScopeIncValue); }
public ActionResult <Patient> Get(int id) { Patient patient = null; try { patient = repository.GetByCondition(p => p.Id == id).FirstOrDefault(); } catch (ArgumentNullException e) { Log.Error($"{CurrentMethod.GetName()}: при обработке запроса произошло исключение {e.GetType()}\n Метод вызвавший исключение: {e.TargetSite.Name}\n Параметр не может быть равен null\n Имя параметра: {e.ParamName}\n Стек вызовов:\n{e.StackTrace}"); return(StatusCode(500)); } if (patient == null) { Log.Information($"{CurrentMethod.GetName()}: пациент Id = {id} отсутствует в базе данных"); return(NotFound()); } Log.Information($"{CurrentMethod.GetName()}: получен пациент Id = {id}"); return(Ok(patient)); }
public ActionResult <ResponseVM> Post([FromBody] VaccinationVM vaccination) { if (vaccination == null) { Log.Information($"{CurrentMethod.GetName()}: не удалось связать модель"); ResponseVM response400 = new ResponseVM { IsSuccess = false, ErrorMessage = "Bad request", StatusCode = 400, Result = "Не удалось связать модель, vaccination была равна null" }; return(BadRequest(response400)); } try { repository.Add(vaccination); } catch (DbUpdateConcurrencyException e) { Log.Error($"{CurrentMethod.GetName()}: при обработке запроса произошло исключение {e.GetType()}\n Метод вызвавший исключение: {e.TargetSite.Name}\n Стек вызовов:\n{e.StackTrace}"); ResponseVM response500 = new ResponseVM { IsSuccess = false, ErrorMessage = "Internal server error", StatusCode = 500, Result = "Внутренняя ошибка сервера" }; return(StatusCode(500, response500)); } catch (DbUpdateException e) { Log.Error($"{CurrentMethod.GetName()}: при обработке запроса произошло исключение {e.GetType()}\n Метод вызвавший исключение: {e.TargetSite.Name}\n Стек вызовов:\n{e.StackTrace}"); ResponseVM response500 = new ResponseVM { IsSuccess = false, ErrorMessage = "Internal server error", StatusCode = 500, Result = "Внутренняя ошибка сервера" }; return(StatusCode(500, response500)); } Log.Information($"{CurrentMethod.GetName()}: добавлена прививка Id = {vaccination.Id}"); ResponseVM response200 = new ResponseVM { IsSuccess = true, StatusCode = 200, Result = $"Добавлена прививка Id = {vaccination.Id}" }; return(Ok(response200)); }
public SystemVote() { InitializeComponent(); //comment for test1 commit Text = "SystemVote: [" + CurrentMethod.ToString() + "]"; }
public void PrintArgs() { string lineTag = "[InjectedTrace]"; try { if (CurrentMethod == null) { Trace.WriteLine(lineTag + "ERROR - PrintArgs: CurrentMethod not set"); } else { Trace.WriteLine(lineTag + DateTime.Now + ";" + CurrentMethod); if (CurrentArguments != null && CurrentArguments.Length > 0) { Trace.WriteLine(lineTag + DateTime.Now + ";" + CurrentMethod + ";Arguments: " + CurrentArguments.Length); ParameterInfo[] parameters = CurrentMethod.GetParameters(); for (int i = 0; i < CurrentArguments.Length; i++) { //Trace.WriteLine("i: " + i + " CurrentArguments.Length: " + CurrentArguments.Length); var currentArgument = CurrentArguments[i]; if (currentArgument == null) { if (parameters != null && parameters.Length > 0) { Trace.WriteLine(lineTag + "Pa: " + parameters[i].Name); } else { Trace.WriteLine(lineTag + "Pa: is null"); } continue; } if (currentArgument is IDictionary) { var dictionary = (IDictionary)currentArgument; var dictionaryBuilder = new StringBuilder(); foreach (var key in dictionary.Keys) { dictionaryBuilder.AppendFormat("{0}={1}|", key, GetStringValue(dictionary[key])); } if (parameters != null && parameters.Length > 0) { Trace.WriteLine(String.Format(lineTag + " [{0}]: {1}", parameters[i].Name, dictionaryBuilder.ToString().TrimEnd(new[] { '|' }))); } } else if (currentArgument is ICollection) { ICollection collection = (ICollection)currentArgument; IEnumerator enumerator = collection.GetEnumerator(); StringBuilder dictionaryBuilder = new StringBuilder(); while (enumerator.MoveNext()) { dictionaryBuilder.AppendFormat("{0},", GetStringValue(enumerator.Current)).AppendLine(); } if (parameters != null && parameters.Length > 0) { Trace.WriteLine(String.Format(lineTag + " [{0}]: {1}", parameters[i].Name, dictionaryBuilder.ToString().TrimEnd(new[] { ',' }))); } } else if (currentArgument is String) { if (parameters != null && parameters.Length > 0) { Trace.WriteLine(String.Format(lineTag + " [{0}]: {1}", parameters[i].Name, currentArgument.ToString())); } } else if (currentArgument is IEnumerable) { IEnumerable enumerator = (IEnumerable)currentArgument; StringBuilder dictionaryBuilder = new StringBuilder(); foreach (var item in enumerator) { dictionaryBuilder.AppendFormat("{0},", GetStringValue(item)).AppendLine(); } if (parameters != null && parameters.Length > 0) { Trace.WriteLine(String.Format(lineTag + " [{0}]: {1}", parameters[i].Name, dictionaryBuilder.ToString().TrimEnd(new[] { ',' }))); } } else { if (parameters != null && parameters.Length > 0) { Trace.WriteLine(String.Format(lineTag + " [{0}]: {1}", parameters[i].Name, GetStringValue(currentArgument))); } } } } } } catch (Exception exception) { Trace.WriteLine(exception); } }
public void Construct(CurrentMethod builder) { builder.MethodA(); builder.MethodB(); builder.MethodC(); }
public ActionResult <ResponseVM> Put([FromRoute] int id, [FromBody] VaccinationVM vaccination) { if (vaccination == null) { Log.Information($"{CurrentMethod.GetName()}: не удалось связать модель"); ResponseVM response400 = new ResponseVM { IsSuccess = false, ErrorMessage = "Bad request", StatusCode = 400, Result = "Не удалось связать модель, vaccination была равна null" }; return(BadRequest(response400)); } VaccinationVM vaccinationFromDB = null; try { vaccinationFromDB = repository.GetByCondition(v => v.Id == id).FirstOrDefault(); } catch (ArgumentNullException e) { Log.Error($"{CurrentMethod.GetName()}: при обработке запроса произошло исключение {e.GetType()}\n Метод вызвавший исключение: {e.TargetSite.Name}\n Параметр не может быть равен null\n Имя параметра: {e.ParamName}\n Стек вызовов:\n{e.StackTrace}"); ResponseVM response500 = new ResponseVM { IsSuccess = false, ErrorMessage = "Internal server error", StatusCode = 500, Result = "Внутренняя ошибка сервера" }; return(StatusCode(500, response500)); } if (vaccinationFromDB == null) { Log.Information($"{CurrentMethod.GetName()}: прививка Id = {id} отсутствует в базе данных"); ResponseVM response404 = new ResponseVM { IsSuccess = false, ErrorMessage = "Not found", StatusCode = 404, Result = $"Прививка Id = {id} отсутствует в базе данных" }; return(NotFound(response404)); } try { repository.Update(vaccination); } catch (ArgumentNullException e) { Log.Error($"{CurrentMethod.GetName()}: при обработке запроса произошло исключение {e.GetType()}\n Метод вызвавший исключение: {e.TargetSite.Name}\n Параметр не может быть равен null\n Имя параметра: {e.ParamName}\n Стек вызовов:\n{e.StackTrace}"); ResponseVM response500 = new ResponseVM { IsSuccess = false, ErrorMessage = "Internal server error", StatusCode = 500, Result = "Внутренняя ошибка сервера" }; return(StatusCode(500, response500)); } catch (DbUpdateConcurrencyException e) { Log.Error($"{CurrentMethod.GetName()}: при обработке запроса произошло исключение {e.GetType()}\n Метод вызвавший исключение: {e.TargetSite.Name}\n Стек вызовов:\n{e.StackTrace}"); ResponseVM response500 = new ResponseVM { IsSuccess = false, ErrorMessage = "Internal server error", StatusCode = 500, Result = "Внутренняя ошибка сервера" }; return(StatusCode(500, response500)); } catch (DbUpdateException e) { Log.Error($"{CurrentMethod.GetName()}: при обработке запроса произошло исключение {e.GetType()}\n Метод вызвавший исключение: {e.TargetSite.Name}\n Стек вызовов:\n{e.StackTrace}"); ResponseVM response500 = new ResponseVM { IsSuccess = false, ErrorMessage = "Internal server error", StatusCode = 500, Result = "Внутренняя ошибка сервера" }; return(StatusCode(500, response500)); } Log.Information($"{CurrentMethod.GetName()}: изменена прививка Id = {id}"); ResponseVM response200 = new ResponseVM { IsSuccess = true, StatusCode = 200, Result = $"Изменена прививка Id = {id}" }; return(Ok(response200)); }
public ascx_WSDL_Creation_and_Execution buildGui() { var topPanel = this.add_Panel(); topPanel.insert_Below(100).add_LogViewer(); //var assemblyInvoke = topPanel.add_Control<O2.External.SharpDevelop.Ascx.ascx_AssemblyInvoke>(); //assemblyInvoke.loadAssembly("OnlineStorage.dll".assembly()); //var methodProperties = topPanel.add_DataGridView(); var methodProperties = topPanel.add_GroupBox("Request Data").add_Control <ascx_ObjectViewer>(); methodProperties.showSerializedString().createObjectWhenNull().simpleView(); Methods_TreeView = methodProperties.parent().insert_Left("Soap Methods").add_TreeView().sort(); ExecutionResult = methodProperties.parent().insert_Below(150).add_GroupBox("Web Service Invocation Response Data").add_TextArea(); ExecutionResult_Properties = ExecutionResult.insert_Right().add_PropertyGrid(); ExecutionResult_TreeView = ExecutionResult_Properties.insert_Below().add_TreeView(); ExecuteSoapRequest_Button = methodProperties.insert_Below(40) .add_Button("Execute Soap request") .font_bold() .fill(); Methods_TreeView.afterSelect <MethodInfo>( (methodInfo) => { CurrentMethod = methodInfo; "Current Method: {0}".info(CurrentMethod.Name); "Current Method: Signature = {0}".info(CurrentMethod.str()); "Current Method: DeclaringType = {0}".info(CurrentMethod.DeclaringType.FullName); SoapParametersObject = methodInfo.create_LiveObject_From_MethodInfo_Parameters("Soap_Invocation_Parameters"); if (SoapParametersObject.notNull()) { methodProperties.visible(true); methodProperties.show(SoapParametersObject); } else { methodProperties.visible(false); } //new O2FormsReflectionASCX().loadMethodInfoParametersInDataGridView(methodInfo, methodProperties); }); ExecuteSoapRequest_Button.onClick( () => { //var parameters = new O2FormsReflectionASCX().getParameterObjectsFromDataGridColumn(methodProperties, "Value"); var invocationParameters = new List <object>(); foreach (var property in SoapParametersObject.type().properties()) { invocationParameters.add(SoapParametersObject.property(property.Name)); } ExecutionResult.set_Text("[{0}] Executing method : {1}".line().format(DateTime.Now, CurrentMethod.Name)); var liveObject = CurrentMethod.DeclaringType.ctor(); ExecutionResult.append_Line("Created dynamic proxy object of type: {0}".format(liveObject)); try { var o2Timer = new O2Timer("Method execution time: ").start(); ResultObject = CurrentMethod.Invoke(liveObject, invocationParameters.ToArray()); ExecutionResult.append_Line("Method execution time: {0}".format(o2Timer.stop())); ExecutionResult.append_Line("Method Executed OK, here is the return value:"); ExecutionResult.append_Line(ResultObject.str().lineBeforeAndAfter()); ExecutionResult_Properties.show(ResultObject); ExecutionResult_TreeView.xmlShow(ResultObject.serialize()); } //catch(System.Web.Services.Protocols.SoapException ex) //{ //} catch (Exception ex) { ExecutionResult.append_Line((ex.InnerException.property("Detail") as System.Xml.XmlElement).OuterXml); ExecutionResult.append_Line(ex.InnerException.Message); ExecutionResult.append_Line(ex.InnerException.StackTrace); //show.info(ex); //ex.details(); } //currentMethod.invoke(parameters); ExecutionResult.append_Line("Execution complete"); }); Methods_TreeView.insert_Below(20) .add_CheckBox("Show Full Method Signatures", 0, 0, (value) => ShowFullMethodSignatures = value) .autoSize() .parent <Panel>() .add_CheckBox("Cache WSDL Dll", 0, 200, (value) => Cache_WSDL_Dll = value) .autoSize() .check(); //.append_Link("Delete cached compiled dll", deleteCachedFile); ExecutionResult.insert_Below(20) .add_Link("View serialized string of response object", 0, 0, () => { var serializedResponse = ResultObject.serialize(false); if (serializedResponse.notNull()) { "".showInCodeViewer().set_Text(serializedResponse, "a.xml"); } }); TestWebServices = topPanel.insert_Above(22).add_ComboBox(); WsdlLocation = topPanel.insert_Above(22) .add_LabelAndTextAndButton("Load Custom WSDL from location (file or url)", "", "Load", (value) => open(value)) .control <TextBox>(); ExtraWsdlParameres = topPanel.insert_Above(22).add_Label("Extra wsdl.exe parameters").left(WsdlLocation.Left).top(2) .append_TextBox("").align_Right(topPanel); addScriptingSupport(); add_TestWebServices(); return(this); }
public LocalBuilder CreateLocal(string pValue, SmallType pType) { return(CurrentMethod.CreateLocal(pValue, pType)); }
void Write(MethodDef method, List <PdbCustomDebugInfo> cdiBuilder) { uint rid = metaData.GetRid(method); if (rid == 0) { Error("Method {0} ({1:X8}) is not defined in this module ({2})", method, method.MDToken.Raw, module); return; } var info = new CurrentMethod(this, method, instrToOffset); var body = method.Body; var symbolToken = new SymbolToken((int)new MDToken(MD.Table.Method, metaData.GetRid(method)).Raw); writer.OpenMethod(symbolToken); seqPointsHelper.Write(this, info.Method.Body.Instructions); var pdbMethod = body.PdbMethod; if (pdbMethod == null) { body.PdbMethod = pdbMethod = new PdbMethod(); } var scope = pdbMethod.Scope; if (scope == null) { pdbMethod.Scope = scope = new PdbScope(); } if (scope.Namespaces.Count == 0 && scope.Variables.Count == 0 && scope.Constants.Count == 0) { if (scope.Scopes.Count == 0) { // We must open at least one sub scope (the sym writer creates the 'method' scope // which covers the whole method) or the native PDB reader will fail to read all // sequence points. writer.OpenScope(0); writer.CloseScope((int)info.BodySize); } else { foreach (var childScope in scope.Scopes) { WriteScope(ref info, childScope, 0); } } } else { Debug.Fail("Root scope isn't empty"); WriteScope(ref info, scope, 0); } PdbAsyncMethodCustomDebugInfo asyncMethod; GetPseudoCustomDebugInfos(method.CustomDebugInfos, cdiBuilder, out asyncMethod); if (cdiBuilder.Count != 0) { customDebugInfoWriterContext.Logger = GetLogger(); var cdiData = PdbCustomDebugInfoWriter.Write(metaData, method, customDebugInfoWriterContext, cdiBuilder); if (cdiData != null) { writer.SetSymAttribute(symbolToken, "MD2", cdiData); } } if (asyncMethod != null) { if (writer3 == null || !writer3.SupportsAsyncMethods) { Error("PDB symbol writer doesn't support writing async methods"); } else { WriteAsyncMethod(ref info, asyncMethod); } } writer.CloseMethod(); }
private void CreateParameter(short pPosition, string pName, SmallType pType, bool pIsRef) { CurrentMethod.CreateParameter(pName, pPosition, pType, pIsRef); }
public ParameterBuilder GetParameter(string pName, out short pIndex) { return(CurrentMethod.GetParameter(pName, out pIndex)); }
public ActionResult <ResponseVM> Put([FromRoute] int id, [FromBody] Patient patient) { if (patient == null) { Log.Information($"{CurrentMethod.GetName()}: не удалось связать модель"); ResponseVM response400 = new ResponseVM { IsSuccess = false, ErrorMessage = "Bad request", StatusCode = 400, Result = "Не удалось связать модель, patient был равен null" }; return(BadRequest(response400)); } Patient sameIdPatient = null; try { sameIdPatient = repository.GetByCondition(p => p.Id == id).FirstOrDefault(); } catch (ArgumentNullException e) { Log.Error($"{CurrentMethod.GetName()}: при обработке запроса произошло исключение {e.GetType()}\n Метод вызвавший исключение: {e.TargetSite.Name}\n Параметр не может быть равен null\n Имя параметра: {e.ParamName}\n Стек вызовов:\n{e.StackTrace}"); ResponseVM response500 = new ResponseVM { IsSuccess = false, ErrorMessage = "Internal server error", StatusCode = 500, Result = "Внутренняя ошибка сервера" }; return(StatusCode(500, response500)); } if (sameIdPatient == null) { Log.Information($"{CurrentMethod.GetName()}: пациент Id = {id} отсутствует в базе данных"); ResponseVM response404 = new ResponseVM { IsSuccess = false, ErrorMessage = "Not found", StatusCode = 404, Result = $"Пациент Id = {id} отсутствует в базе данных" }; return(NotFound(response404)); } // если был получен новый СНИЛС, проверить используется ли новый СНИЛС другим пациентом if (sameIdPatient.SNILS != patient.SNILS) { Patient sameSNILSPatient = null; try { sameSNILSPatient = repository.GetByCondition(p => p.SNILS == patient.SNILS).FirstOrDefault(); } catch (ArgumentNullException e) { Log.Error($"{CurrentMethod.GetName()}: при обработке запроса произошло исключение {e.GetType()}\n Метод вызвавший исключение: {e.TargetSite.Name}\n Параметр не может быть равен null\n Имя параметра: {e.ParamName}\n Стек вызовов:\n{e.StackTrace}"); ResponseVM response500 = new ResponseVM { IsSuccess = false, ErrorMessage = "Internal server error", StatusCode = 500, Result = "Внутренняя ошибка сервера" }; return(StatusCode(500, response500)); } if (sameSNILSPatient != null) { Log.Information($"{CurrentMethod.GetName()}: пациент с таким СНИЛС уже есть"); ResponseVM response409 = new ResponseVM { IsSuccess = false, ErrorMessage = "Conflict", StatusCode = 409, Result = "Пациент с таким СНИЛС уже есть" }; return(Conflict(response409)); } } try { repository.Update(patient); } catch (ArgumentNullException e) { Log.Error($"{CurrentMethod.GetName()}: при обработке запроса произошло исключение {e.GetType()}\n Метод вызвавший исключение: {e.TargetSite.Name}\n Параметр не может быть равен null\n Имя параметра: {e.ParamName}\n Стек вызовов:\n{e.StackTrace}"); ResponseVM response500 = new ResponseVM { IsSuccess = false, ErrorMessage = "Internal server error", StatusCode = 500, Result = "Внутренняя ошибка сервера" }; return(StatusCode(500, response500)); } catch (DbUpdateConcurrencyException e) { Log.Error($"{CurrentMethod.GetName()}: при обработке запроса произошло исключение {e.GetType()}\n Метод вызвавший исключение: {e.TargetSite.Name}\n Стек вызовов:\n{e.StackTrace}"); ResponseVM response500 = new ResponseVM { IsSuccess = false, ErrorMessage = "Internal server error", StatusCode = 500, Result = "Внутренняя ошибка сервера" }; return(StatusCode(500, response500)); } catch (DbUpdateException e) { Log.Error($"{CurrentMethod.GetName()}: при обработке запроса произошло исключение {e.GetType()}\n Метод вызвавший исключение: {e.TargetSite.Name}\n Стек вызовов:\n{e.StackTrace}"); ResponseVM response500 = new ResponseVM { IsSuccess = false, ErrorMessage = "Internal server error", StatusCode = 500, Result = "Внутренняя ошибка сервера" }; return(StatusCode(500, response500)); } Log.Information($"{CurrentMethod.GetName()}: изменен пациент Id = {id}"); ResponseVM response200 = new ResponseVM { IsSuccess = true, StatusCode = 200, Result = $"Изменен пациент Id = {id}" }; return(Ok(response200)); }